Skip to content

elidupuis/broccoli-svgstore

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

broccoli-svgstore

A simple Broccoli task to combine SVG files as described in a recent CSS Tricks article for SVG sprite-based icon systems. Comparable to grunt-svgstore and gulp-svgstore. Heavily inspired by broccoli-concat.

Installation

npm install broccoli-svgstore --save

Usage

The filter accepts one input tree full of SVG files and outputs a tree with a single file as named by the outputFile option.

var svgstore = require("broccoli-svgstore");

var outputTree = svgstore(inputTree, {
  outputFile: "/assets/icons.svg"
});

Inject the file into an HTML document and use <svg><use xlink:href="icon-name"></svg> to place an image on the page.

Notes

This was created in a couple of hours to take SVGs from Sketch to a webapp using Broccoli. Options are pretty sparse, there are no tests, and no other use cases have been considered so far. It's little more than a proof-of-concept in its current state.

Pull requests welcome. Please try to keep things consistent with the philosophy of Broccoli & the spirit of the surrounding plugin community.

Version History

v0.1.0

initial release

About

Broccoli plugin to combine SVG files using <symbol>

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%