transpile-iconify
v0.0.30
Published
Transpile Iconify is a command-line tool that transforms SVG files into JSON format for use with Iconify.
Downloads
8
Maintainers
Readme
Transpile Iconify
Transpile Iconify is a command-line tool that transforms SVG files into JSON format for use with Iconify.
Usage
transpile-iconify <svg-path> [options]
Parameters
<svg-path>
: Path to the SVG files you want to transform. Supports glob patterns.
Options
--output
: Output JSON filename (default: 'icons.json')--prefix
: Prefix for the icons
Examples
transpile-iconify ./path/to/icons/**/*.svg
transpile-iconify ./path/to/icons/**/*.svg --output=icons.json
transpile-iconify ./path/to/icons/**/*.svg --output=icons.json --prefix=iconify
How It Works
- The script reads all SVG files from the specified path.
- It parses each SVG file and extracts the necessary information.
- The extracted data is transformed into the Iconify JSON format.
- The resulting JSON is written to the specified output file.
Output Format
The output JSON file will have the following structure:
{
"folderName": {
"prefix": "folderName",
"icons": {
"iconName": {
"body": "<path d=\"...\" fill=\"currentColor\"/>",
"width": 24,
"height": 24
}
}
}
}
Dependencies
- glob: For file pattern matching
- xml2js: For parsing SVG files
- cleye: For command-line argument parsing