@tadashi/spritetify
v2.2.1
Published
Generate SVG sprite
Downloads
787
Readme
spritetify
Generate SVG sprite
Install
$ npm i -S @tadashi/spritetify
Usage
CLI
Usage: spritetify [options]
Generate SVG sprite
Options:
-V, --version output the version number
-d, --inputDir <dir> directory with the SVG files
-o, --outputFile <file> name with path of output file
-c, --configFile [json] plugin options
-h, --help display help for command
Samples
$ npx spritetify -d dir/with/svg/files > ./sprite.svg
$ npx spritetify -d dir/with/svg/files -o dir/of/sprite/file.svg -c
API
import spritetify from '@tadashi/spritetify'
const data = await spritetify('dir/with/svg/files')
// => <svg width="0" height="0" display="none" version="1.1...
spritetify(inputDir [, outputFile] [, options]):String
parameter | type | required | default | description ----------- | -------------------- | ----------- | ------------------- | ------------ inputDir | String | yes | - | directory with the SVG files outputFile | String | no | - | name with path of output file options | Object | no | see below | plugin options
⚠️ Attention
If outputFile
is not set, the return will be the sprite's string.
options
parameter | type | required | default | description ----------- | -------------------- | ----------- | ------------------- | ------------ id | String | no | %s | Template for Symbol ID ...rest | - | no | - | SVGO Options
The remaining options are the same of SVGO
Options
spritetify.config.json
{
"id": "my_app_%s",
"plugins": [
"removeTitle"
]
}
License
MIT © Thiago Lagden