Answer the question
In order to leave comments, you need to log in
Why does gulp (v4) throw "Did you forget to signal async completion?"?
Hello!
gulpfile.js:
'use strict';
const gulp = require('gulp');
const sass = require('gulp-sass');
const clean = require('gulp-clean');
var arrBlocksNames = [
'sass.common.blocks'
];
function cleanSassBlocks() {
arrBlocksNames.forEach(function(blocksName) {
return gulp.src(blocksName + '/**/*.css' )
.pipe(clean({force: true}));
});
}
gulp.task('default', gulp.series(cleanSassBlocks));
[13:26:11] Starting 'default'...
[13:26:11] Starting 'cleanSassBlocks'...
[13:26:11] The following tasks did not complete: default, cleanSassBlocks
[13:26:11] Did you forget to signal async completion?
Answer the question
In order to leave comments, you need to log in
Thanks for the answers, but I figured it out myself and solved the problem like this:
arrBlocksNames.forEach(function(blocksName) {
gulp.task(blocksName, function() {
return gulp.src(blocksName + '/**/*.css')
.pipe(clean({force: true}));
});
});
You need to add done to the function argument.
And at the end of the function, write done();
That's all
You need to start the continuation of the process:
function cleanSassBlocks(f) { f();
arrBlocksNames.forEach(function(blocksName) {
return gulp.src(blocksName + '/**/*.css' )
.pipe(clean({force: true}));
});
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question