How do you make grunt.js not crash on warnings by default?

gruntjs

Solution

Register your own task, which will run the tasks you want. Then you have to pass the `force` option:

grunt.registerTask('myTask', 'runs my tasks', function () {
    var tasks = ['task1', ..., 'watch'];

    // Use the force option for all tasks declared in the previous line
    grunt.option('force', true);
    grunt.task.run(tasks);
});

Problem

I'm using Grunt to compile CoffeeScript and Stylus with a watch task. I also have my editor (SublimeText) set to save files every time I page away from them (I hate losing work). Unfortunately, if Grunt hits a syntax error in any of the files it's compiling, it throws a warning and quits with `Aborted due to warnings`. I can stop it doing this by passing `--force`. Is there any way to make not aborting the default behavior (or control which tasks' warnings are important enough to quit Grunt?

Original source

Related problems