mrsum / webpack-svgstore-plugin

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

Generate output SVG on add/remove input icon file #164

Open firestar300 opened 6 years ago

firestar300 commented 6 years ago

Hi

My Webpack config :

new SvgStore(
      path.resolve(__dirname, './../src/img/icons/*.svg'),
      path.resolve(__dirname, './../dist/assets/icons/'),
      {
        name: 'icons',
        prefix: 'icon-',
        chunk: 'svg',
        svgoOptions: {
          plugins: [
            {
              removeTitle: true,
            },
          ],
        },
      }
    ),

My JS entry file :

  //SVG
  let __svg__ = {
    path: '../img/icons/*.svg', // entry
    name: '../icons/icons.svg', // output
  }
  require('./vendor/svgxhr')(__svg__)

The output SVG sprite rebuild when i update my entry JS file. How can I watch for svg images and when i add/remove SVG images, my sprite rebuild ?

lgordey commented 6 years ago

I'm afraid this will not work now. But feel free to send a pull request.