inline-svg-sprite
v1.1.4
Published
Inlines an SVG sprite and updates references for IE compatablity
Downloads
62
Readme
inline-svg-sprite
npm install inline-svg-sprite --save-exact
Inspired by https://css-tricks.com/ajaxing-svg-sprite/. Inlines external svgs sprites and updates xlink:href
attributes in <use>
tags to reference the inlined svg.
Usage
import inlineSvgSprite from 'lib/inline-svg-sprite'
// For our good friends IE 11 and below :)
inlineSvgSprite(spritePath, iconSelector)
spritePath
string, required
The path to your icon-sprite.
iconSelector
string, optional
Default: svg.icon
This selector is used to find svg elements and update the xlink:href
attributes in <use>
tags. When an SVG is inlined, full urls are stripped, leaving just the ID.