From 320bbb60f35918ec7a8a252b3308bea585adeeb8 Mon Sep 17 00:00:00 2001 From: Matthew Kime Date: Tue, 31 Mar 2015 12:25:44 -0400 Subject: [PATCH 1/2] options by task --- README.md | 22 ++++++++++++++++++++++ tasks/newer.js | 5 +++++ 2 files changed, 27 insertions(+) diff --git a/README.md b/README.md index 1ad205f..8872a30 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,28 @@ Example use of the `override` option: }); ``` +#### options[task] + * type: `object` + +This allows overriding options on a per task level. + +Example: + +```js + grunt.initConfig({ + newer: { + options: { + less: { + override: function(detail, include) { + //no longer need to check the task name + checkForModifiedImports(detail.path, detail.time, include); + } + } + } + } + }); +``` + ## That's it Please [submit an issue](https://github.com/tschaub/grunt-newer/issues) if you encounter any trouble. Contributions or suggestions for improvements welcome! diff --git a/tasks/newer.js b/tasks/newer.js index 14bb0ee..50ea7f6 100644 --- a/tasks/newer.js +++ b/tasks/newer.js @@ -50,6 +50,11 @@ function createTask(grunt) { override: nullOverride }); + if(options[taskName]) { + options = grunt.util._.extend(options, options[taskName]); + delete options[taskName]; + } + // support deprecated timestamps option if (options.timestamps) { grunt.log.warn('DEPRECATED OPTION. Use the "cache" option instead'); From f9c625437de784011db051a2e8fb8d0738da198a Mon Sep 17 00:00:00 2001 From: Matthew Kime Date: Tue, 31 Mar 2015 12:44:31 -0400 Subject: [PATCH 2/2] update changelog and package.json --- changelog.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 51fd822..aa28786 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Change Log +## 1.2.0 + + * Add newer options on a per task basis + ## 1.1.0 * Write current time to timestamp file (thanks @malys, see [#69][69]) diff --git a/package.json b/package.json index 57af6d0..191f1ce 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "grunt-newer", "description": "Run Grunt tasks with only those source files modified since the last successful run.", - "version": "1.1.0", + "version": "1.2.0", "homepage": "https://github.com/tschaub/grunt-newer", "author": { "name": "Tim Schaub",