Answer the question
In order to leave comments, you need to log in
gulp-notify fails in gulp-plumber. What could be wrong?
Handling errors in SCSS using gulp-plumber. Gulp-plumber works (gulp doesn't crash on errors), but it fails to print 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))
Answer the question
In order to leave comments, you need to log in
I can share a working solution.
.pipe(plumber({
errorHandler: function(err) {
notify.onError({
title: "Ошибка в CSS",
message: "<%= error.message %>"
})(err);
}
}))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question