Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top