Unexpected result when I use gulp.dest() #2504
-
What were you expecting to happen?Hi, I have a problem with gulp.dest when I use it to double generate. const stream = gulp.src(['./test.txt');
stream.pipe(gulp.dest('./zh'));
stream.pipe(gulp.dest('./en')); I want to generate Chinese copy and English copy. What actually happened?But I only get the English copy. gulp.src(['./test.txt');
.pipe(gulp.dest('./zh'));
.pipe(gulp.dest('./en')); it works, I would get the right result, a Chinese copy and a English copy. Please give us a sample of your gulpfileHere is github action https://github.com/zhangzhiqiang37/gulp-dest-test/runs/1281077531?check_suite_focus=true Please provide the following information:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
That is actually just the behavior of nodejs streams. You can't pipe the result to 2 different outputs and you'd need something like a "tee stream", such as something like https://github.com/streamxorg/teex (I'm not sure if it works on standard node streams). However, it's not recommended to split a gulp stream and instead apply your transforms inline. You can even filter files after they've been modified or written. I'm going to convert this to a discussion because it is not really an issue with gulp. |
Beta Was this translation helpful? Give feedback.
That is actually just the behavior of nodejs streams. You can't pipe the result to 2 different outputs and you'd need something like a "tee stream", such as something like https://github.com/streamxorg/teex (I'm not sure if it works on standard node streams).
However, it's not recommended to split a gulp stream and instead apply your transforms inline. You can even filter files after they've been modified or written.
I'm going to convert this to a discussion because it is not really an issue with gulp.