Gulp-notify doesn't work in gulp-plumber. What could be wrong?
I handle errors in SCSS via gulp-plumber. Gulp-plumber is triggered (gulp does not crash on errors), but it is not possible to output notifications to the console.
Current code:
const gulp = require('gulp');
sourcemaps = require('gulp-sourcemaps');
notify = require("gulp-notify");
plumber = require("gulp-plumber");
sass = require('gulp-sass');
const onError = function (err) {
notify({
title: 'Gulp Task Error',
message: 'Check the console.'
}).write(err);
console.log(err.toString());
this.emit('end');
};
gulp.task('css', () => {
gulp.src( config.src.cssEntry )
.pipe(plumber({ errorHandle: onError }) )
.pipe(sourcemaps.init() )
.pipe(sass({outputStyle: 'expanded'} )
.on('error', onError))
What could be wrong?
0
1 answers
I have such a design works:
gulp.task('css', function() {
gulp.src('./sass/*.sass')
.pipe(sourcemaps.init())
.pipe(
sass()
.on('error', notify.onError({
title: "Sass Error",
message: "<%= error.message %>",
sound: "Blow"
}))
)
.pipe(sourcemaps.write())
.pipe(gulp.dest('./public/css/'))
});
1
Author: Vadizar, 2018-04-19 13:57:15