gatsby-plugin-svg-spritemap

1.0.2 • Public • Published

gatsby-plugin-svg-spritemap

Gatsby plugin to generate a SVG spritemap on build time using svg-spritemap-webpack-plugin

Usage

In your gatsby-config, include:

module.exports = {
    plugins: [
        ...
        "gatsby-plugin-svg-spritemap"
    ],
}

To specify a filename pattern, you can pass them as a string or an array of strings under the pattern option. The plugin also accepts all the other options available to the webpack plugin, so you can include them as well.

For more details on the available options, check the original plugin documentation.

module.exports = {
  plugins: [
        ...
        {
            resolve: "gatsby-plugin-svg-spritemap",
            options: {
                pattern: ["./src/icons/*.svg", "./src/icons/**/*.svg"],
                output: {
                    filename: `icons/sprite.svg`,
                },
                sprite: { prefix: false },
            }
        }
  ],
}

Package Sidebar

Install

npm i gatsby-plugin-svg-spritemap

Weekly Downloads

65

Version

1.0.2

License

0BSD

Unpacked Size

3.2 kB

Total Files

6

Last publish

Collaborators

  • lmai