Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aleclarson/grunt-then
Anonymous tasks and targets in Grunt.
https://github.com/aleclarson/grunt-then
Last synced: 8 days ago
JSON representation
Anonymous tasks and targets in Grunt.
- Host: GitHub
- URL: https://github.com/aleclarson/grunt-then
- Owner: aleclarson
- License: mit
- Created: 2015-03-10T10:16:29.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-12-05T14:34:30.000Z (almost 6 years ago)
- Last Synced: 2024-05-01T22:24:37.030Z (6 months ago)
- Language: CoffeeScript
- Homepage:
- Size: 9.77 KB
- Stars: 13
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# grunt-then v1.0.0
Schedule a `Function` to be called without ever registering it via `grunt.registerTask`. This is called an **anonymous task**.
```JavaScript
grunt
.run("coffee")
.then(function () {
console.log(this.name)
})
```As seen above, the `this` context in anonymous tasks is [just like in normal tasks](http://gruntjs.com/api/inside-tasks).
-
Plus, you can fail an anonymous task early (just like in normal tasks).
```JavaScript
grunt.task
.then(function () {
return false // synchronous failure
})
.then(function () {
var done = this.async()
performAsyncOperation(function () {
done(false) // asynchronous failure
})
})
```-
Debugging is easier when an anonymous task has a description. Of course, this is optional.
```Javascript
grunt.task.then("A description of what I'm doing", function () {
// do cool grunty things
})
```If the `--verbose` flag is used and a description is provided, it will be printed when the anonymous task starts.
-
Schedule an existing task to be called with a single-use configuration. This is called an **anonymous target**.
```JavaScript
grunt.then("clean", {
// Calls the 'clean' task with temporary configuration (after the previous task completes).
})
```install
-------```sh
npm install --save-dev grunt-then
```In your Gruntfile:
```Javascript
grunt.loadNpmTasks("grunt-then")
```Use [`load-grunt-tasks`](https://github.com/sindresorhus/load-grunt-tasks) when you have more than one NPM task to load.