grunt icon indicating copy to clipboard operation
grunt copied to clipboard

Call after (or done) callback after task ends

Open schovi opened this issue 12 years ago • 16 comments
trafficstars

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.

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?

schovi avatar Apr 22 '13 20:04 schovi

:+1:

pwmckenna avatar Sep 24 '13 16:09 pwmckenna

+1

I wanna use grunt-notify whenever a task finishes ; something like this would be very useful.

nicooprat avatar Nov 27 '13 10:11 nicooprat

:+1:

andrewmartin avatar Mar 19 '14 17:03 andrewmartin

+1

fluffybunnies avatar Mar 31 '14 23:03 fluffybunnies

+1

rantiev avatar Apr 05 '14 12:04 rantiev

+1

Luckvery avatar Jun 13 '14 21:06 Luckvery

:+1:

13ruce1337 avatar Jun 24 '14 21:06 13ruce1337

:+1:

chchrist avatar Jul 15 '14 13:07 chchrist

:+1: #542 mentioned plans to bring an event-based hook mechanism in https://github.com/tkellen/node-task Unfortunately this subproject has been stopped.

bentolor avatar Aug 12 '14 11:08 bentolor

+100

digitalmaster avatar Sep 01 '14 23:09 digitalmaster

+101

jonnung avatar Sep 10 '14 14:09 jonnung

I added a gist which I use to hook around the grunt.task.run here: https://gist.github.com/mdasberg/92455614afbe6987cc8f

mdasberg avatar Feb 12 '15 13:02 mdasberg

That would be great +1

mitramejia avatar Nov 21 '15 00:11 mitramejia

+100

isader avatar Jan 02 '16 11:01 isader

+1000

dev-mraj avatar Feb 15 '16 08:02 dev-mraj

+1

crossdot avatar Nov 17 '17 11:11 crossdot