iconfont-map-builder
Advanced tools
Comparing version 1.0.1 to 1.0.2
22
index.js
@@ -10,2 +10,3 @@ #!/usr/bin/env node | ||
var CSSOM = require('cssom'); | ||
var Common = require('./common'); | ||
@@ -35,21 +36,12 @@ | ||
var content = elem.style.content.replace(/"\\([0-9a-z]+)"/,'0x$1'); | ||
map[String(matched[nameGrp])] = parseInt(content); | ||
map[matched[nameGrp]] = parseInt(content); | ||
} | ||
} | ||
}); | ||
var output = [ | ||
"/** Created by iconfont-map-builder */", | ||
"var map =", | ||
JSON.stringify(map), | ||
";module.exports = (name)=>String.fromCharCode(map[name]);"]; | ||
fs.writeFileSync(mapFile,output.join('\n')); | ||
} | ||
function printUsage(){ | ||
console.log([ | ||
'Usage:', | ||
"iconmap -f <css file> -p <extract pattern> [-n] [group number of icon's name in the regexp pattern,default 1]" | ||
].join('\n')); | ||
fs.writeFileSync(mapFile,Common.generateModule(map)); | ||
} | ||
if(require.main === module){ | ||
@@ -59,3 +51,3 @@ try { | ||
if (argv.indexOf('-h')>-1 || argv.indexOf('--help')>-1) { | ||
printUsage(); | ||
Common.printUsage(); | ||
return; | ||
@@ -73,5 +65,5 @@ } else if (argv.indexOf('-f') > 0 && argv.indexOf('-p') > 0) { | ||
} | ||
printUsage(); | ||
Common.printUsage(); | ||
}else{ | ||
module.exports = buildCss; | ||
} |
{ | ||
"name": "iconfont-map-builder", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Transform iconfont's css file to js 'name-character' map ", | ||
@@ -10,3 +10,4 @@ "main": "index.js", | ||
"bin":{ | ||
"iconmap":"./index.js" | ||
"iconmap":"./index.js", | ||
"iconmap-codepoint":"./codepoint.js" | ||
}, | ||
@@ -13,0 +14,0 @@ "repository":{ |
# iconfont-map-builder | ||
Simple command tool to transform iconfont's css file to a js mapping moudle . | ||
Simple command tool to transform iconfont's css/codepoint file to a js mapping moudle . | ||
I'm using the module in [react-native-iconic-font](<https://github.com/sospartan/react-native-iconic-font>) to generate the iconic map file | ||
## Usage | ||
@@ -5,0 +7,0 @@ install this tool via npm |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73395
10
2745
28
2