inline-svg-sprite

1.1.4 • Public • Published

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.

Package Sidebar

Install

npm i inline-svg-sprite

Weekly Downloads

27

Version

1.1.4

License

MIT

Last publish

Collaborators

  • viget