Hi everyone
I have a custom error handler that's supposed to show a notification with gulp-notify and then log it in the console when sass compiler fail.
var errorHandler = function(error) {
notify.onError({
title: 'Task Failed [' + error.plugin + ']',
message: 'Sass ha ricontrato un errore',
sound: true
})(error);
this.emit('end');
notify("Files has an error");
return notify().write(error);
};
function scss() {
return src("product-template/Product Template/assets/styles/scss/**/*.scss")
.pipe(sourcemaps.init())
.pipe(sass())
.on("error", errorHandler)
.pipe(prefix(/*{grid: "no-autoplace"}*/))
.pipe(sourcemaps.write("./"))
.pipe(dest("./product-template/Product Template/assets/styles/css/"))
.pipe(browserSync.stream());
}
Expected behavior
This piece of code supposed to, when sass has an error, to show a notification Os (windows) message (toast) with a title, body ecc
Real behavior
The piece of code actualy doesn't work it only log the message of error in the console. Don't the expected behavior
Try this.