Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

options by task #75

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,28 @@ Example use of the `override` option:
});
```

#### <a id="optionstask">options[task]</a>
* 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!
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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])
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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.1",
"version": "1.2.0",
"homepage": "https://github.com/tschaub/grunt-newer",
"author": {
"name": "Tim Schaub",
Expand Down
5 changes: 5 additions & 0 deletions tasks/newer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down