Skip to content

Inlines external svgs sprites and updates `xlink:href` attributes in `<use>` tags to reference the inlined svg.

Notifications You must be signed in to change notification settings

vigetlabs/inline-svg-sprite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 '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.

About

Inlines external svgs sprites and updates `xlink:href` attributes in `<use>` tags to reference the inlined svg.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published