floatdrop / gulp-plumber

Fixing Node pipes
MIT License
806 stars 32 forks source link

gulp-plumber handling syntax errors only in the main sass file and not in partials #60

Open mrassili opened 6 years ago

mrassili commented 6 years ago

I'm having an issue with gulp-plumber, when I intentionally make a syntax error in my main file, the error is being shown in console (so it works perfectly) but when I make an error in some partial sass file it compiles and ignore the error for some reason! Also, it only handles the error if I do an error in partial name in the @import line (i.e. @import 'compLnents/buttons') and not when I write (@iLport 'components/buttons')

this is my gulpfile.js

var gulp = require('gulp');

// Plugins
var plugins = require('gulp-load-plugins')();

var sassPattern = 'sass/**/*.scss';

// Sass to CSS
gulp.task('sass', function() {
    // Gets all .scss files in sass/ and children dirs
    return gulp.src(sassPattern)
        .pipe(plugins.plumber(function(error) {
            console.log(error.toString());
            this.emit('end');
        }))
        .pipe(plugins.sourcemaps.init())
        .pipe(plugins.sass())
        .pipe(plugins.minifyCss())
        .pipe(plugins.sourcemaps.write('.'))
        .pipe(gulp.dest('css'))
});

// Watch task
gulp.task('watch', function() {
    return gulp.watch(sassPattern, ['sass']);
});

// Default task
gulp.task('default', ['sass','watch']);