image-webpack-loader icon indicating copy to clipboard operation
image-webpack-loader copied to clipboard

Possible to use other plugins? (imagemin-guetzli etc.)

Open lostpebble opened this issue 8 years ago • 6 comments

I'd like to make use of the new JPEG compression from Google, https://github.com/google/guetzli/

I see there is an imagemin plugin for it: https://github.com/imagemin/imagemin-guetzli

I've downloaded it and tried to use it by just adding some options to it in the query:

{
        test: /\.(jpe?g|png|gif|svg)$/i,
        loaders: ['file-loader?context=src/images&name=images/[path][name].[ext]', {
          loader: 'image-webpack-loader',
          query: {
            guetzli: {
              quality: 95,
            },
            gifsicle: {
              interlaced: false,
            },
            optipng: {
              optimizationLevel: 4,
            },
            pngquant: {
              quality: '75-90',
              speed: 3,
            },
          },
        }],
        exclude: /node_modules/,
        include: __dirname,
      },

But this doesn't seem to work. I think it would be cool if we could easily add plugins like this. Or perhaps I'm missing the right way to do it?

lostpebble avatar Mar 22 '17 12:03 lostpebble

Yeah it would be quite easy to add a new plugin into this lib. but probably would be more ideal if we could pass our own optimizers manually

milewski avatar Mar 24 '17 08:03 milewski

Well i just added it myself with this pull request https://github.com/tcoopman/image-webpack-loader/pull/86

But keep in mind that this new google jpg compressor consomes a looooooooooooooooot of CPU and memory.. i mean ... really a lot.. my 32gb memory machine wasn't able to compile the project i am currently working on in time... it took like 20 minutes to compile.... god.. this is not viable in development.. and probably nor even in production O.O

milewski avatar Mar 24 '17 09:03 milewski

Has this been resolved? Not specific to imagemin-guetzli, are we able to somehow pass in other imagemin plugins?

scorgn avatar Sep 04 '18 22:09 scorgn

@ShawnCorrigan https://github.com/milewski/imagemin-loader i made a version that u can pass any plugin manually

milewski avatar Sep 05 '18 03:09 milewski

@milewski Ah thanks, I made a PR with the ability to pass any plugin, but I guess it's not likely to be accepted.

scorgn avatar Sep 05 '18 03:09 scorgn

i did that too.. https://github.com/tcoopman/image-webpack-loader/pull/86 but never got a response

milewski avatar Sep 05 '18 03:09 milewski