Reputation: 139
I'm trying to get a notification when my gulp-ruby-sass compiler has an error. I've tried many of the suggestions found on here, but nothing gives me the error notification. I do receive the "task complete" notification so I know that notifications are working. Also, I've commented out some of the other methods that I've tried. Thanks!
gulp.task('styles', function() {
sass('src/css/style.scss', {
style: 'expanded',
})
.on('error', notify.onError({ message: 'Error'}))
// .on('error', function(err) {
// notify.onError({
// title: 'Error!',
// message: '<%= error.message %>',
// sound: 'Beep'
// })(err);
// this.emit('end');
// })
// .pipe(notify({ message: 'Error' }))
// .pipe(plumber({
// errorHandler: reportError
// }))
.pipe(autoprefixer('last 2 version'))
.pipe(gulp.dest('dist/assets/css'))
.pipe(rename({suffix: '.min'}))
.pipe(cssnano())
.pipe(gulp.dest('dist/assets/css'))
.pipe(notify({ message: 'Styles task complete' }));
});
Upvotes: 0
Views: 192
Reputation: 388
In the gitHub page of the repo says what you could use to log the errors:
gulp.task('styles', function() {
sass('src/css/style.scss', {
style: 'expanded',
})
.on('error', sass.logError)
.pipe(autoprefixer('last 2 version'))
.pipe(gulp.dest('dist/assets/css'))
.pipe(rename({suffix: '.min'}))
.pipe(cssnano())
.pipe(gulp.dest('dist/assets/css'))
.pipe(notify({ message: 'Styles task complete' }));
});
Try that and tell me if it works.
Upvotes: 0