Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Gulp forking a stream (e.g. send different files to different dests)
gulp.task("ts", function() {
// These would be the names of two source files for example
tsRootFiles = ["rab", "buildRab"];
tsRootFiles.forEach(tsFile => {
let stream = gulp
noImplicitAny: true,
outFile: `${tsFile}.js`,
allowJs: true,
lib: ["ES2016"],
target: "ES5",
// Now send them different places (here based on name but obvs. whatever logic suits)
if (tsFile === "rab") {
stream = stream.pipe(gulp.dest("_build/js"));
} else {
stream = stream.pipe(gulp.dest("banners/js"));
return stream;

This comment has been minimized.

Copy link

@LeoEatle LeoEatle commented Apr 26, 2020

let stream1 = stream.pipe(gulp.dest("_build/js"));
let stream2 = stream.pipe(gulp.dest("banners/js"));

Fork stream and run in the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.