A metalsmith plugin that inlines svg images into your html to reduce the number of http requests.
Remember to be selective over which svgs you inline. If you inline svgs which appear on multiple pages you wont benefit from caching which you get with individually loaded files!
This plugin doesn't remove the svg files after as it does no checking to see if they're used elsewhere.
npm install metalsmith-inline-svg
var inlineSVG = ;
- selector: A jQuery/cheerio selector string used to find the images to be replaced (default
- removeDefs: A boolean which tells the plugin whether to remove
<defs />tags. I had some issues where the
DOMParserwas not correctly closing empty
defstags so we strip them out. (default