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.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i inline-svg-sprite

      Weekly Downloads

      9

      Version

      1.1.4

      License

      MIT

      Last publish

      Collaborators

      • viget