svg-to-symbols
v1.0.7
Published
Combine several SVG file into a single symbols library
Downloads
9
Readme
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
viewBox
attributes of SVGs. - Remove
width
andheight
attributes for better CSS control. - Option to change the
stroke
attribute tocurrentColor
for 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.svg
if not provided.changeStroke
- Optional. Set totrue
to change thestroke
attribute of all child elements within symbols tocurrentColor
.fillNone
- Optional. Set totrue
to 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