webpack-svg-sprite-wrapper

0.0.1 • Public • Published

webpack-svg-sprite-wrapper

A wrapper around svg-sprite for Webpack.

Notes

This is a quick'n'dirty Webpack plugin to get an old project (5+ years) to work with a modern bundler. For now, it's only written with having that in mind. I'll bet there are tons of better solution out there. Like vue-cli-plugin-svg-sprite for Vue-based projects.

Usage

// webpack.config.js
const SvgSpritePlugin = require('webpack-svg-sprite-wrapper')

module.exports = {
    plugins: [
        new SvgSpritePlugin({
            name: 'legacySprite',
            srcDir: './legacy/static/img/svg/',
            dest: 'static/img/',
            config: {
                shape: {
                    spacing: {
                        // Add padding
                        padding: 3,
                    },
                },
                mode: {
                    // Activate the «view» mode
                    view: {
                        sprite: 'legacy-sprite.svg',
                        bust: true,
                        render: {
                            // Activate CSS output (with default options)
                            css: {dest: '[name].css'},
                        },
                    },
                    // Activate the «symbol» mode
                    symbol: false,
                },
            },
        }),
    ]
}

Other configuration options

Readme

Keywords

Package Sidebar

Install

npm i webpack-svg-sprite-wrapper

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

10.1 kB

Total Files

5

Last publish

Collaborators

  • emm-ess