Skip to content

Releases: patrickxchong/eleventy-plugin-svg-sprite

v2.4.2

14 Aug 09:02
Compare
Choose a tag to compare

v2.0.0

29 Oct 16:13
Compare
Choose a tag to compare

Set SVG id naming convention

Support array config in plugin

03 Sep 06:36
Compare
Choose a tag to compare

Allow plugin user to pass in config either as a single javascript object, or an array of config javascript objects to create multiple SVGSprite shortcodes. Examples below:

Single config object

const svgSprite = require("eleventy-plugin-svg-sprite");

module.exports = function (eleventyConfig) {
  eleventyConfig.addPlugin(svgSprite, {
    path: "./src/assets/svg", // relative path to SVG directory
    // (MUST be defined when initialising plugin)
  });
};

Array of config objects

const svgSprite = require("eleventy-plugin-svg-sprite");

module.exports = function (eleventyConfig) {
  eleventyConfig.addPlugin(svgSprite, [
    {
      path: "./src/assets/svg_1", // relative path to SVG directory
      svgSpriteShortcode: "svgsprite1",
    },
    {
      path: "./src/assets/svg_2", // relative path to SVG directory
      svgSpriteShortcode: "svgsprite2",
    }
  ]);
};

Refer to README and demo folder for additional guidance.