tschaub / grunt-newer

Configure Grunt tasks to run with newer files only.
https://npmjs.org/package/grunt-newer
MIT License
945 stars 53 forks source link

newer:imagemin:dynamic and newer:imagemin when only one in task #46

Open dheian opened 10 years ago

dheian commented 10 years ago

Installed newer today and started using it with imagemin. Though the only task specified is newer:imagemin:dynamic, I found that it ran followed by imagemin dynamic:

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

Here's the config:

module.exports = function(grunt) {
var mozjpeg = require('imagemin-mozjpeg');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
imagemin: {                          // Task
dynamic: {
 files: [{
    expand: true,                  // Enable dynamic expansion
    cwd: '.',                   // Src matches are relative to this path
    src: ['**/*.{png,jpg,gif}'],   // Actual patterns to match
    dest: '.'                  // Destination path prefix
  }]
    }
}
  });
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-newer');
grunt.registerTask('default', ['newer:imagemin:dynamic']);
};

Thanks for any advice.

elliot619 commented 8 years ago

Here with the same issue, anyone with a solution?

codephobia commented 8 years ago

+1

dimitarkolev commented 8 years ago

Please make grunt-newer work again with grunt-contrib-imagemin. It doesn't no matter how you configure it.

kfiku commented 8 years ago

Hi i find solution to this issue. In my example imagemin changes modification date of image by cleaning milliseconds from original file. Original file: 2016-04-15 12:16:14.877814125 +0200 Complied file: 2016-04-15 12:16:14.000000000 +0200 my solution to this is set option in newer task tolerance: 1000 or more.

options: {
  tolerance: 1000
}