How to use gulp browserSync plugin to make sass errors? here is the config

gulp.task('sass', function(){ return gulp.src('app/sass/**/*.sass') .pipe(sass({outputStyle:'expanded'}).on('error', sass.logError)) .pipe(autoprefixer(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true })) .pipe(gulp.dest('app/css')) .pipe(browserSync.reload({stream: true})) }); gulp.task('browser-sync', function() { browserSync({ server: { baseDir: 'app' }, notify: false }); }); 

    1 answer 1

    BrowserSync , this is not a plugin for gulp , it is a full-fledged dev server with the ability to gulp update all connected devices, with which you can even show results to clients.

    BrowserSync nothing to do with sass compiler sass .

    To properly handle any errors when using gulp use a bunch of modules -

    • gulp-plumber - does not allow gulp crash when an error occurs.
    • gulp-notify - beautifully shows errors displaying them in the pop-up windows of the system.

    Specifically, in your cases, you need to delete the line following gulp.src and add it to its place (of course connecting the modules in advance) -

     .pipe( plumber( { errorHandler: notify.onError( "ERROR: <%= error.message %>" ) } ) )