Skip to content

Create SVG sprite with no build configuration based on SVG files from given folder

License

Notifications You must be signed in to change notification settings

achwilko/create-svg-sprite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

create-svg-sprite

Create SVG sprite with no build configuration based on SVG files from given folder.

Installation

Using npm:

npm install create-svg-sprite

Usage

CLI

Usage:
    create-svg-sprite [OPTIONS] [ARGS]

Options:
    --optimize optimize SVG input files (default false)
    --quiet avoid logs during creation (default false)
    --input INPUT_FOLDER input folder with SVG files to process (default "./icons")
    --output OUTPUT_FOLDER output folder for created SVG sprite (default "./sprite")
    --name SPRITE_NAME SVG sprite name (default "icons")

Examples

  • Create and optimize SVG sprite "my_icons.svg" in "./static" folder from SVG files placed in "./assets" folder:
create-svg-sprite --optimize --input "./assets" --output "./static" --name "my_icons"
  • Create and optimize SVG sprite "icons.svg" in "sprite" folder from SVG files placed in "icons" folder:
create-svg-sprite --optimize

Sprite output

Please note that all icons in sprite have a prefix "icons--" in their ids. For example, having icons like "alert.svg" and "info.svg" will generate sprite with ids like "icons--alert" and "icons--info".

About

Create SVG sprite with no build configuration based on SVG files from given folder

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published