3

I am trying to build my sass with gulp sass and i get the error:

The following tasks did not complete: build, clean Did you forget to signal async completion?

gulp.task('clean', function() { return del.sync('dist'); });

 gulp.task('build', gulp.series('clean', 'imagemin', 'sass', 'js', function(done) {

var buildMain = gulp.src([
    'app/*.html',
    'app/.htaccess'
]).pipe(gulp.dest('dist'));

var buildCss = gulp.src([
    'app/css/main.min.css'
    ])
.pipe(gulp.dest('dist/css'));

var buildJs =  gulp.src([
    'app/js/scripts.min.js'
    ])
.pipe(gulp.dest('dist/js'));

var buildFonts = gulp.src([
    'app/fonts/**/*'
    ])
.pipe(gulp.dest('dist/fonts'));
done(); }));
  • possible duplicate: https://stackoverflow.com/questions/36897877/gulp-error-the-following-tasks-did-not-complete-did-you-forget-to-signal-async – I0_ol Jan 01 '19 at 19:06

2 Answers2

3

Like Sven Schoenung said in this question:

This is a much more fitting mechanism for your use case. Note that most of the time you won't have to create the Promise object yourself, it will usually be provided by a package (e.g. the frequently used del package returns a Promise).

I tried this approach and for me is working. The code will be:

gulp.task('clean:dist', function (resolve) {
  del.sync('dist');
  resolve();
})
1

For the latest version of gulp you can use:

export const build = series(clean, imagemin, sass, js);

No additional wrapper function needed.

https://gulpjs.com/docs/en/api/series/#usage

Nizami
  • 25
  • 7