I use a browser , so I can use npm modules in my interface and gulp to complete my build tasks. This works great:
var browserify = require('gulp-browserify'); gulp.task('js', ['clean'], function() { gulp .src('./public/js/src/index.js') .pipe(browserify({ insertGlobals : true, debug : ! gulp.env.production })) .pipe(gulp.dest('./public/js/dist')) });
However, if there is a syntax error in my JS, I would like to receive an error notification through an OS X notification. I saw this similar question and changed my code to add .on('error'...) after .browserify() :
// Browserify/bundle the JS. gulp .src('./public/js/src/index.js') .pipe(browserify({ insertGlobals : true, debug : ! gulp.env.production }).on('error', function(err){ notify.onError({ message: "Error: <%= error.message %>", title: "Failed running browserify" } this.emit('end'); }) .pipe(gulp.dest('./public/js/dist'))
However, this does not report a violation of my JS. Adding console.log () inside on('error',...) also not logged. I suspect because this question is not related to using the gulp pipeline.
How can I get error notifications while scrolling to gulp browning?
source share