mrsum / webpack-svgstore-plugin

Simple svg-sprite creating with webpack
https://www.npmjs.com/package/webpack-svgstore-plugin
200 stars 92 forks source link

Compile on webpack --watch #149

Closed CarpenterBug closed 6 years ago

CarpenterBug commented 6 years ago

Hello github'ers,

I've an issue that, after several hours searching, I haven't found a solution.

When I ran npm run build, all icons inside my folder are compiled correctly. However, if I run npm run dev (which runs webpack --watch) and add a new icon to the folder, nothing happens.

Here are the files that contain SvgStore code:

webpack.config.js

var SvgStore = require('webpack-svgstore-plugin');
new SvgStore({
    svgoOptions: {
      plugins: [
        { removeDoctype: true },
        { removeTitle: true },
        { removeMetadata: true },
        { removeComments: true },
        { removeDesc: true },
        { cleanupIDs: true },
        { removeDimensions: true }
      ]
    },
    prefix: ''
  });

main.js

let __svg__ = {
  path: '../../icons/partials/**/*.svg', name: '../icons/icons.svg',
};

require('webpack-svgstore-plugin/src/helpers/svgxhr')(__svg__);

What am I missing?

Thank you in advance

lgordey commented 6 years ago

It won't rebuild after add/remove svgs.
But feel free to make pr. :)