I am trying to use Gulp-Notify's error handling function, but I keep getting the following error:
TypeError: dest.on is not a function
I am following the instructions here: https://www.npmjs.com/package/gulp-notify#notifyonerror but keep getting the same error.
Here is my file:
const gulp = require('gulp');
const rename = require('gulp-rename');
const sass = require('gulp-sass');
const cleancss = require('gulp-clean-css');
var plumber = require("gulp-plumber");
var through = require('gulp-through');
var notify = require("gulp-notify");
gulp.task('styles', function(){
gulp.src('builders/stylesheets/style.scss')
.pipe(sass())
.pipe(cleancss())
.pipe(rename('style.min.css'))
.pipe(gulp.dest('assets/css'))
.pipe(notify("Saved Styles!"))
.pipe(plumber({errorHandler: notify.onError("Error: <%= error.message %>")}))
.pipe(through(function () {
this.emit("error", new Error("Something happend: Error message!"))
}));
});
Any idea what it could be?
I appreciate any of the help!
Thanks!
Brad
Tested your task and the error comes from your
through
and not from thenotify
.If you delete this pipe it runs without problems. The gulp-through documentation shows an example, but i couldn't find there a usecase with
pipe
.