gulp-usemin icon indicating copy to clipboard operation
gulp-usemin copied to clipboard

Need help with problem of using gulp-usemin with Gulp 4.

Open ivanzhaowy opened this issue 9 years ago • 1 comments

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

ivanzhaowy avatar Sep 03 '16 12:09 ivanzhaowy

try using runSequence. Seems that one of your tasks is running too early/too late to play nicely with usemin.

harrisrobin avatar Nov 08 '16 21:11 harrisrobin