简体   繁体   中英

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?

使用grunt-contrib-imagemin v1.0.1和grunt-newer v0.8.0解决了该问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM