Reputation: 33079
I have my default task in my gulpfile.js that looks something like this:
gulp.task('default', [
'jshint',
...
]);
What I'd like to do is have the rest of the tasks not execute if task jshint
returns warnings. In other words, "fail fast."
Is this possible? It appears to me that the tasks under default
are run async, out of order—not serial.
Upvotes: 2
Views: 654
Reputation: 10104
You need to do two things:
fail
reporter with jshint to make it throw errors instead of warnings.jshint
task so that jshint
always runs first.gulp.task('default', ['js']);
gulp.task('jshint', function() {
return gulp.src('*.js')
.pipe(jshint(opts))
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});
gulp.task('js', ['jshint'], function() {
//somethin
});
Upvotes: 2