Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gulp silently failing - no errors printed to console

Tags:

gulp

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" ) );
 });
like image 994
jpmerritt Avatar asked Mar 12 '14 06:03

jpmerritt


1 Answers

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:

example output

like image 161
Adam Grant Avatar answered Sep 19 '22 15:09

Adam Grant