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

Support override option to force inclusion of older files #35

Closed tschaub closed 10 years ago

tschaub commented 10 years ago

When the newer task determines that a src file should not be included (because it has not been modified more recently than the corresponding dest file or the previous task run time), the user may still want this file to be processed. This happens when the src file "depends" on other files that might have been modified - e.g. a LESS file that imports another file.

To support this, the newer task can be configured with an override function. This function will be called for every file that would otherwise be considered "older." If the override function calls the provided callback with a truthy value, the file will be included for processing (or considered "newer").

The override function looks like this:

grunt.initConfig({
  newer: {
    options: {
      override: function(details, include) {
        // decide if the file should be included
        include(true); // include everything!
      }
    }
  } // other tasks ...
});

The function is called with 2 arguments:

tschaub commented 10 years ago

Published as grunt-newer@0.7.0.