0

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' }));
});
Raktim Biswas
  • 4,011
  • 5
  • 27
  • 32
leclaeli
  • 139
  • 2
  • 6

1 Answers1

0

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.

franmartosr
  • 378
  • 1
  • 5
  • 10
  • This does the same thing as above. I get an error message in the console, however I'm still not getting a notification of an error. I only get the "Styles task complete" notification. – leclaeli Jun 03 '16 at 13:39