D
D
Dmitry Sergeevich2015-10-07 20:21:19
Web development
Dmitry Sergeevich, 2015-10-07 20:21:19

How to run tasks sequentially in Gulp.js?

Hello! When I first started using Gulp.js, somewhere while reading articles and docs, suggestions flashed about the problems of running tasks asynchronously. And then the day came when I faced this problem.
I have 4 tasks to minify four html css js and img folders. Each task individually normally fulfills and performs its task. With asynchronous launch, of course, everything crashes. Moreover, the work of tasks does not overlap in any way, they work with different files.
5ec3ccbd0ab14316be32244a63952516.jpg
My attempts to solve the problem:

  1. A wonderful article on the front-end, which contained code with incorrect task syntax.
    So this solution didn't work.
  2. Topics on Stackoverflow about different ways of launching by linking tasks, using callbacks, and so on. So this solution didn't work.
  3. Great run-sequence plugin. So I couldn't run it.

In general, it looks like I have some kind of crooked task. Help, good people.
I won’t throw everything off, I’ll just show the structure (as it is now and works separately).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
ChickenGrinder, 2015-10-08
@CheckOneTwo

I use the plugin https://github.com/teambition/gulp-sequence
Gulp 4 has this feature out of the box:

gulp.task("sequence", gulp.series(
    "firstTask",
    gulp.parallel("taskA", "taskB"),
    "secondTask",
    "thirdTask",
    function fourthTask() {
       // do stuff
    }
));

_
_ _, 2015-10-08
@AMar4enko

Attach the entire galpfile if you want help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question