Open callumacrae opened 9 years ago
@callumacrae you can try to reemit error
event from onError
handler. Or you can try to use callback version of js-quality
task:
gulp.task('js-quality', function (cb) {
gulp.src('./src/js/**/*.js')
.pipe(plugins.plumber(function (err) { onError(err); cb(err); } ))
.pipe(plugins.jscs())
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter(stylish))
.on('end', cb);
});
I wonder how to make this work too. Reemitting error event from handler leads to infinite recursions. In cb version, callbacks will be called multiple times. The only workaround to connect such tasks I found is global variables...
+1 for the right way to do this, preferably compatible with Gulp4.
In Gulp 3 you can call 'this.destroy()' in plumber error handler to prevent 'end' event from firing.
.pipe( plugins.plumber( { errorHandler: function ( error ) {
onError( error );
this.destroy();
} } ) )
I have the two following tasks:
When js-quality fails, I want
onError
to be called (which pipes the error through to browser-sync and beeps), but I don't want thejs
task to run.Is there any way to do this, or is this something I'll have to work around until Gulp 4?