My gulp file is not emitting any errors on either standard gulp methods like gulp.src() with non existant paths nor are stream errors being called by their handler. I've included a simple file that silently fails, printing only the starting.. and finished.. default messages.
var //
gulp = require( "gulp" ),
gulpUtil = require( "gulp-util" ),
sass = require( "gulp-ruby-sass");
gulp.task( "default", function() {
gulp.src( "path-that-does-not-exist.scss" )
.pipe( sass() )
.on( "error", function( err ) {
console.log( "this should print" );
})
.pipe( gulp.dest( "./client-side/public/compiled" ) );
});
Okay, so Gulp is working "correctly." But what I'm hearing in your question is that it would be nice if Gulp could just tell you if a file doesn't exist.
I use gulp-expect-file as such
var coffee = require('gulp-coffee');
var expect = require('gulp-expect-file');
gulp.task('mytask', function() {
var files = ['idontexist.html'];
return gulp.src(files)
.pipe(expect(files))
.pipe(coffee());
});
Now you'll see this in the terminal:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With