0

I have the following code in my glup.js file

var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');

gulp.task('default', function() {
    gulp.src('./stylesheets/*.{scss,sass}')
    .pipe(sourcemaps.init())
    .pipe(sass().on('error', sass.logError))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('./css'));
});

gulp.task('default',function() {
    gulp.watch('sass/**/*.scss',['default']);
});

If I have valid sass in my style.scss file it correctly generates the style.css and style.css.map files, however, if errors are in the style.scss file no output is propogating to the console.

Does anyone have any ideas as to why?

1 Answers1

0

You have two tasks named default. Name the first sass and change your watch task to execute the sass command.

Also, my error logging looks like this, with and extra .sync() method call:

.pipe(sass.sync().on('error', sass.logError))
Tibor Szasz
  • 3,028
  • 2
  • 18
  • 23