Ava Gaiety Wroten / svgdir2sprite
Created 2019-01-03 Modified 2019-01-03

95 Words

Creates a spritesheet from a directory of svgs.

Fork from Gitlab

svgdir2sprite

npm version

Creates a spritesheet from a directory of svgs. Can return the results directly or write to a spritesheet svg file. Node based and powered by svg2sprite.

As a Module

npm install --save svgdir2sprite

Return SVG Spritesheet as String

const svgdir2sprite = require('svgdir2sprite');

svgdir2sprite('./src/svgs') // Async Promise
.then((svgContent) => console.log(svgContent));

Write SVG Spritesheet to File

const svgdir2sprite = require('svgdir2sprite');

svgdir2sprite('./src/svgs', './build/spritesheet.svg');

From the CLI

npm install -g svgdir2sprite

Return SVG Spritesheet to the Console

svgdir2sprite ./src/svgs

Write SVG Spritesheet to File

svgdir2sprite ./src/svgs ./build/spritesheet.svg