Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run all Grunt SubTasks except one

I've a bunch of subtasks for grunt watch (e.g. grunt watch:styles, grunt watch:sprites, etc). Then many other tasks run grunt watch. I would like to exclude one task. Is there a way to specify that? Basically run all grunt watch subtasks except grunt watch:dist.

I know I could create another task and only specify the subtasks I'm actually interested on, however, if I add another subtask later, that means now I've to add it, so I would rather not do it that way.

Thanks

like image 865
Miguel Madero Avatar asked Jun 03 '14 05:06

Miguel Madero


1 Answers

There might be a better way, but this is doing the trick for now:

grunt.registerTask('watch:basic', function () {
    delete grunt.config.data.watch.dist;
    grunt.task.run('watch');
});

Fortunately, in this case, I don't have other tasks that might run grunt watch:dist, so it's safe to simply remove the config, but I can think of other cases where this approach would create conflicts.

like image 145
Miguel Madero Avatar answered Sep 17 '22 13:09

Miguel Madero