gruntjs / gruntjs/grunt

Call after (or done) callback after task ends

Open
#770 16 comments 0 reactions 0 assignees View on GitHub
Component: tasks Type: Enhancement
Dominant language
JavaScript
Stars
12.2k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

I have developement task like
`grunt.registerTask("dev", ["server", "jshint", "copy:dev", "coffeelint", "coffee", "watch"])`
which will start server and copy files from /src into /public where is index.html and server pointed.

This will copy (or compile) lot of files into public directory.
After my work session I want to cleanup this directory. I looked for something like `after`, `done` or `teardone` callback which will run some task after the main task is killed, or finished.

``` javascript
var task = grunt.registerTask("dev", ["server", "jshint", "copy:dev", "coffeelint", "coffee", "watch"])

// With Deferred API this will be called when main task is break, killed, finished or end from any other reason
task.always(function() {
grunt.task.requires('cleanup');
})
```

I tried to check sources, but did not find anything like this. Is there any way, how to do that, or is it planning feature?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.