I've got gulpfile.js set up like this:
var scripts = [
    'bower_components/timezone-js/src/date.js',                            
    'bower_components/jquery/jquery.min.js',                               
    'bower_components/jquery-migrate/jquery-migrate.js',                   
    'bower_components/jquery-ui/ui/minified/jquery-ui.min.js',              
    'bower_components/jqueryui-touch-punch/jquery.ui.touch-punch.min.js',  
    ...
];
gulp.task('scripts', function () {
    return gulp.src(scripts, {base: '.'})
        .pipe(plumber(plumberOptions))
        .pipe(sourcemaps.init({
            loadMaps: false,
            debug: debug,
        }))
        ...
i.e., all my script files are exact matches. No globbing.
Every now and then I mess up a file path or the author changes the directory structure. I want to be notified when this happens instead of the script silently being excluded and causing run-time errors.
Is there some way for me to make gulp.src report these kinds of errors?
Use gulp-expect-file as per this answer.
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());
});
(Thanks rve)
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