svg-to-symbols

1.0.7 • Public • Published

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 and height attributes for better CSS control.
  • Option to change the stroke attribute to currentColor 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 to icons.svg if not provided.
  • changeStroke - Optional. Set to true to change the stroke attribute of all child elements within symbols to currentColor.
  • fillNone - Optional. Set to true to set the symbol fill to none

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

Readme

Keywords

Package Sidebar

Install

npm i svg-to-symbols

Weekly Downloads

0

Version

1.0.7

License

MIT

Unpacked Size

4.06 kB

Total Files

3

Last publish

Collaborators

  • edualfaro