svg-to-symbols v1.0.7
SVG to Symbols
svg-to-symbols is a Node.js module that combines multiple SVG files into a single SVG file as a library of symbols. It's a simple yet powerful tool for managing SVG icons in web projects. This module can also modify SVGs to use currentColor for strokes and allows custom naming for the output file.
Features
- Combine multiple SVG files into one SVG file with symbols.
- Preserve individual
viewBoxattributes of SVGs. - Remove
widthandheightattributes for better CSS control. - Option to change the
strokeattribute tocurrentColorfor all child elements within symbols. - Customizable output file name.
Installation
Install the package globally using npm:
bash
npm install -g svg-to-symbols
Usage
Navigate to a directory containing your SVG files and run:
bash
svg-to-symbols [outputFileName.svg] [changeStroke] [fillNone]
outputFileName.svg- Optional. Specify the name of the output file. Defaults toicons.svgif not provided.changeStroke- Optional. Set totrueto change thestrokeattribute of all child elements within symbols tocurrentColor.fillNone- Optional. Set totrueto set the symbol fill tonone
Example
To combine SVGs in the current directory into my-icons.svg and change the stroke color:
bash
svg-to-symbols my-icons.svg true
To combine SVGs into the default icons.svg without changing the stroke color:
bash
svg-to-symbols
License
Distributed under the MIT License. See LICENSE for more information.
Contact
Edu Alfaro - https://edualfaro.com