2.2.1 • Published 3 years ago
@tadashi/spritetify v2.2.1
spritetify
Generate SVG sprite
Install
$ npm i -S @tadashi/spritetifyUsage
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 commandSamples
$ npx spritetify -d dir/with/svg/files > ./sprite.svg$ npx spritetify -d dir/with/svg/files -o dir/of/sprite/file.svg -cAPI
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