2

Other answers were not helpful. I'm using Gulp 4 on Windows 10.

I get the following error when running 'gulp serve'

The following tasks did not complete: serve, sass
[18:48:51] Did you forget to signal async completion?

My gulpfile.js

var gulp = require('gulp');
var sass = require('gulp-sass');
var browserSync = require('browser-sync');
var reload = browserSync.reload;

gulp.task('sass', function() {
    return sass('./public_html/lib/scss/main.scss')
        .pipe(gulp.dest('./public_html/css'))
        .pipe(reload({ stream:true }));
});
gulp.task('serve', gulp.series('sass', function() {
    browserSync({
        server: {
            baseDir: 'public_html'
        }
    });
    gulp.watch('lib/scss/*.scss', gulp.series('sass'));
}));
sinrise
  • 391
  • 3
  • 21
  • Mark's answer is the correct way to do this on Gulp 4 -- and here's why it's needed: https://stackoverflow.com/a/36899424/1454514 – David Refoua Mar 26 '19 at 03:49

1 Answers1

5

Try this instead:

gulp.task('sass', function() {

    return gulp.src('./public_html/lib/sass/main.scss')
        .pipe(sass()).on("error", sass.logError))
        .pipe(gulp.dest('./public_html/css'))
        .pipe(reload({ stream:true }));
});

Note you need gulp.src, then a call to sass.

Mark
  • 143,421
  • 24
  • 428
  • 436