Gulp watch crashes in between if any error is found -


i writing gulp task browserify, compile less files css , run gulp-webserver. on client side using react 0.14. moment error found in browserify, gulp watch crashes. every time have stop watch task , run again. how avoid this? mean if error found , if fix error, how can again run browserify task without watch getting crashed. if error in browserify like: closing jsx tag missing...and once fix error, how stop watch crashing.

var gulp        = require('gulp'); var browserify  = require('browserify'); var babelify    = require("babelify"); var source      = require('vinyl-source-stream'); var plugins     = require('gulp-load-plugins')(); var runsequence = require('run-sequence'); var watchless   = require('gulp-watch-less'); var domain      = require("domain");  gulp.task('webserver', function(){     gulp.src('./')     .pipe(plugins.webserver({       fallback   : 'index.html',       host       : 'localhost',       livereload : {         enable : true       },       open       : true     })) })  gulp.task('browserify', function(){   console.log('browserifying ...');     return browserify({     entries : ['./js/index.js'],     debug   : true   })   .transform('babelify', {presets: ['es2015', 'react']})   .bundle()   .on('error', function(err) {     console.log('error:', err);   })   .pipe(source('bundle.js'))   .pipe(gulp.dest('./')) })  gulp.task('build-css', function(){   return gulp.src('./less/**/*.less')     .pipe(plugins.less())     .pipe(gulp.dest('./css')) })  gulp.task('build', function() {   runsequence(     ['build-css'], ['browserify'], ['webserver'], ['watch']   ); });  gulp.task('watch', function(){   gulp.watch('./js/*.js',['browserify'])   gulp.watch('./less/**/*.less',['build-css'])   gulp.watch('./css/**/*.css') }) 

add in error handling method:

this.emit('end')


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -