我正在尝试使用 gulp sass 构建我的 sass,但出现错误:
以下任务未完成:构建、清理 您是否忘记发出异步完成信号?
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(); }));
最佳答案
赞Sven Schoenung在这说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).
我尝试了这种方法,对我来说很有效。代码将是:
gulp.task('clean:dist', function (resolve) {
del.sync('dist');
resolve();
})
关于Gulp 4 你忘了发出异步完成信号吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53998102/