Answer the question
In order to leave comments, you need to log in
How to make sequential execution of tasks in GULP?
It is necessary that:
1) first, the media-queries merge function is performed in the css file (gulp-group-css-media-queries)
2) CSS is compressed (gulp-cssnano)
Used this code:
gulp.task('gcmq', function ( ) {
gulp.src(path.src.css)
.pipe(gcmq())
.pipe(gulp.dest(path.build.csstemp));
});
gulp.task('styles', function () {
gulp.src(path.src.csstemp)
.pipe(cssnano(cssNanoCfg))
.pipe(gulp.dest(path.build.css));
});
gulp.task('styles:build',
gulpSequence('gcmq', 'styles')
);
Tried without overwriting the same file, in different ways. As a result, the 2nd task is not executed, as if the file did not have time to be created so that compression was applied to it.
Plz tell me how to solve this problem?
Answer the question
In order to leave comments, you need to log in
Wrap each task in a promise that will resolve to .on('end') relatively speaking. And then build a chain task1.then(() => task2.then() => and so on, then they will be executed sequentially)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question