mixtur / webpack-spritesmith

Webpack plugin that converts set of images into a spritesheet and SASS/LESS/Stylus mixins
499 stars 56 forks source link

Output to Webpack's internal asset array #56

Open Jazcash opened 6 years ago

Jazcash commented 6 years ago

Is it possible to keep the output files generated by this plugin in webpack's pipe, rather than writing to disk, making it easy to do other things with the spritesheets after they've been generated?

https://github.com/Klathmon/imagemin-webpack-plugin/issues/37#issuecomment-326554467

mixtur commented 6 years ago

Initially files generated by plugin were meant to be used as sources, not as final assets. With that in mind your original issue could be solved by using file-loader as in example in readme. Then file-loader would pick generated images and put them into webpack's assets, allowing other plugins to work on them.

When plugin used that way it don't make any sense to add generated images to webpack's assets. Yet when generated image IS used as final asset it indeed makes sense, also it would probably work slightly faster with webpack-dev-server.

Plugin would have to deside between these two behaviours. Via some flag in config, I guess.

So yes. It is possible, but I am not sure if it is necessary.