gruntjs / grunt-contrib-imagemin

Minify PNG, JPG, GIF and SVG images.
https://gruntjs.com
MIT License
1.21k stars 175 forks source link

Getting dynamic image paths to work with a custom optimizationLevel #357

Closed florian closed 7 years ago

florian commented 8 years ago

I'm sorry if I just made some trivial mistake in the config but I can't get dynamic image paths to work with a custom optimizationLevel.

This is my config:

    imagemin: {
      dynamic: {
        options: {
          optimizationLevel: 7
        },

        files: [{
          expand: true,
          cwd: '.',
          src: ['img/**/*.png'],
          dest: 'dist/'
        }]
      }
    }

It works in general, but it ignores the optimizationLevel. I tried to use options just like in the example for static image paths.

Is this a problem with this grunt plugin or did I just make a mistake in the config?

florian commented 8 years ago

I also tried changing the source code of this plugin here and it didn't have any effect when changing the level to 7. Maybe the options are not passed correctly to the PNG minifier…

My images can be compressed further by grunt-image, so that's not the problem either.

kevva commented 7 years ago

Can you try out 2.0.0? If the issue still persists I'll reopen.