I'm supporting a build process that uses gulp and trying to troubleshoot a problem. To troubleshoot this, I'd like to know if the code that makes multiple calls to gulp.src().pipe().dest() in a single gulp task is legal and correctly written.
More exactly, I want to know if gulp.src().pipe().dest() completes prior to the next javascript line that makes another call to gulp.src().pipe().dest().
The code would look like this:
gulp.src(getSrcFiles())
.pipe(dostuff)
.pipe(dostuff2)
.dest('temp');
// will the above copy complete before I try doing substitutions
gulp.src('temp/**')
.pipe(mySubstitutions)
.dest('temp')
gulp.src('temp/**')
.dest('dist')
The question is will the first pipeline of gulp.src().pipe().pipe().dest()
complete prior to the next line which performs some variable substitutions on the files copied in the first pipeline?
I didn't see the answer in the gulp documentation at https://gulpjs.org/API.html#gulp-dest-path-options.
Some other questions I found that did not answer my question were:
Q.js Promises in Gulp Loop (not answered, but similar issue being raised).
gulp run sequence after promise resolve (similar question not answered)
How does gulp treat the Promise of a then()? (similar question, crickets, no answer:-))
More questions but no answers... I have a gut feeling I'm going to answer this one myself after I figure it out, and then I'll be able to answer some of the other questions.
A great question and answer that will help me understand gulp and how it ensures ordering of tasks is What does Gulp "done" method do?. The gulp npm run-sequence docs were also very useful, see https://www.npmjs.com/package/run-sequence.
UPDATE: I found someone else who reported this as a problem.