kuzyk / gulp-rigger

Javascript file parser and include engine #buildjs #node http://buildjs.github.io/rigger
41 stars 3 forks source link

Doesn't show an error in gulp-notify, only in console. #18

Open neins opened 5 years ago

neins commented 5 years ago

I had a gulp 3 configuration with gulp-plumber as error handler (so current running task never crashes) and also had a gulp-notify as a message alert to system in a case for errors, for example if I made a mistake in the path of the file name, such as an empty space at the end, there was a handy notify. But i recently update my gulp to 4 version and here the problems started - gulp-plumber stopped working, current task doesn't fail in the 4th version of gulp (in case a space typo on the end of filepath), only alert in console, so plumber became unnecessarily thing in this configuration in my opinion, and unfortunately gulp-notify also stopped working.

//My old gulp 3 task:

gulp.task('htmlTemplate', function () {
    return gulp.src(path.layout.htmlTemplate) 
        .pipe(plumber({errorHandler: notify.onError({
            message: "Error: <%= error.message %>",
            title: "HTML - ошибка компиляции"
          })}))
        .pipe(rigger())
        .pipe(gulp.dest(path.layoutDest.html))
        .pipe(reload({stream: true})); 
});

//Current gulp 4, unfortunantely notifier and onerror doesn't work

gulp.task('htmlTemplate', function () {
    return gulp.src(path.layout.htmlTemplate)
        .pipe(rigger()
            .on('error', notify.onError({
                message: "Error: <%= error.message %>",
                title: "HTML - ошибка компиляции"
            })
        ))
        .pipe(rigger()) 
        .pipe(gulp.dest(path.layoutDest.html))
        .pipe(reload({stream: true})); 
});

Maybe someone have a working configuration in gulp 4?