tschaub/grunt-newer — pull request #35 by tschaub (2014-03-01 20:34:37+00:00)
Title: (WIP) Support override option to force inclusion of older files

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:

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

The function is called with 5 (five!) arguments:

* **taskName** - `string` The currently running task name.
* **targetName** - `string` The multi-task target name.
* **filePath** - `string` The path to the "older" file (relative to `process.cwd()`).
* **time** - `Date` The comparison time (corresponding `dest` file mtime or previous task run time).
* **include** - `function(boolean)` The callback. Call this with `true` if the file should be included. Call with a falsey value otherwise.

That's a bear of a function signature, but it feels like all of the args are needed. Alt suggestions welcome.