Unexpected result with series() #2564
Replies: 3 comments 1 reply
-
Hey @franck-paul - I converted this to a Discussion because you are just asking for help and support questions belong here. As for your issue, you are handling async completion incorrectly. The callback method is only used for node-style callback methods. If you are using gulp streams, you need to return your streams, as data is processed in chunks. |
Beta Was this translation helpful? Give feedback.
-
The question is: how can I know if I must use stream or other things? I don't know and the documentation is not simple and detailed enough for a newbie like me. |
Beta Was this translation helpful? Give feedback.
-
So I stop using function zip_pack (done) {
gulp
.src(pjson.module + '-' + pjson.name + '-' + pjson.version + '/**/*')
.pipe(zip(pjson.module + '-' + pjson.name + '-' + pjson.version + '.zip'))
.pipe(gulp.dest(paths.pack));
done();
} I switch to: function zip_pack() {
return gulp
.src(pjson.module + '-' + pjson.name + '-' + pjson.version + '/**/*')
.pipe(zip(pjson.module + '-' + pjson.name + '-' + pjson.version + '.zip'))
.pipe(gulp.dest(paths.pack));
} It works, I don't know why, but it works! |
Beta Was this translation helpful? Give feedback.
-
What were you expecting to happen?
Wish to have 3 tasks (prepare_pack, zip_pack, clean_pack) done with a 4th one (pack) using series(…)
What actually happened?
Each run give me a different result.
At 1st run, only Task 1 seems to have a good result, the new folder is created.
At 2nd run, I got an error (see below)
At 3rd run, I got a badly formed zip archive from previous folder where some files are missing.
If I run each task separately, the result is as expected.
My gulpfile.js
Terminal output / screenshots
But only prepare_pack ran, then
If I do:
Everything is allright.
Please provide the following information:
What am I doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions