Search code examples
javascriptnode.jsgruntjsnpmgrunt-contrib-imagemin

Grunt newer:imagemin always runs imagemin:dynamic


I have a Gruntfile like:

grunt.initConfig({
  imagemin: {
    dynamic: {
      files: [
        src: ['lib/public/img/*.{png,jpg,jpeg,gif}'],
        dst: 'build/public/img/',
        expand: true,
        flatten: true
      ]
    }
  }
});

grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-newer');

When I do grunt newer:imagemin, it logs the following:

Running "newer:imagemin" (newer) task

Running "newer:imagemin:dynamic" (newer) task

Running "imagemin:dynamic" (imagemin) task
Minified 192 images (saved 1.3 MB)

Running "newer-postrun:imagemin:dynamic:1:/home/goferito/versus/node_modules/grunt-newer/.cache" (newer-postrun) task

The first time makes sense, but the second time I run it, just right after, it shouldn't minify anything new. But it minifies the 192 images again.

I've checked, and grunt-newer is saving the timestamp in its /node_modules/grunt-newer/.cache/imagemin/dynamic/timestamp

Versions:

"grunt-contrib-imagemin": "^1.0.0",
"grunt-newer": "^1.1.1"

Anyone with an idea about where to start looking?


Solution

  • Using grunt-contrib-imagemin v1.0.1, and grunt-newer v0.8.0 solved it.