gulp-usemin
gulp-usemin copied to clipboard
Need help with problem of using gulp-usemin with Gulp 4.
Hi everyone, I recently tried to migrate from Gulp 3 to Gulp 4, I use gulp-usemin in my project, I have a task like this:
gulp.task('usemin', function () {
return gulp.src('.tmp/**/*.html')
.pipe($.usemin({
css: ['concat', $.cleanCss],
js: ['concat', $.uglify]
}))
.pipe(gulp.dest('dist'));
});
This works fine but when I try to pass some options into uglify or cleanCss task like this:
gulp.task('usemin', function () {
return gulp.src('.tmp/**/*.html')
.pipe($.usemin({
css: ['concat', $.cleanCss],
js: ['concat', $.uglify({ outSourceMap: true })]
}))
.pipe(gulp.dest('dist'));
});
Gulp break the workflow and throughout this:
[20:29:31] The following tasks did not complete: build, usemin
[20:29:31] Did you forget to signal async completion?
What should I do to avoid this? Thx
try using runSequence. Seems that one of your tasks is running too early/too late to play nicely with usemin.