@psoares/svg-list
Version:
Generates a JSON or Javascript list with optimised SVGs strings
47 lines (32 loc) • 1.49 kB
Markdown
> Generates a JSON or Javascript list with optimised SVGs
[](https://www.npmjs.com/package/@psoares/svg-list) [](https://standardjs.com)
This small script is useful to maintain your project icons updated and optimised without having the painful work of everytime you change an svg icon file you need to go through SVG optimizer, clean the code and then just add it to you custom js or json files.
```bash
yarn add @psoares/svg-list
```
- Create your setup file in the root of your project with the name `.svglistrc.json`
```javascript
{
"passAllAttributes": true, // optional: this will ensure all attrs from each pass will be passed to the generated file
"src": "icons", // source directory with multiple directories
"dest": "src/components/icons", // target directory for js / json fiiles
"format": "js", // optional: `js` (default) or `json`
}
```
- To generate your files run
```bash
yarn svglist generate
```
- To preview your generated files run
```bash
yarn svglist preview
```
This will fireup a simple react app that runs in port 8004 with a preview of all the svgs that you have generated.
**Note**: *this will not generate the svg files for you, so you need to run generate first*
MIT © [psoaresbj](https://github.com/psoaresbj)