Last active
December 23, 2019 17:09
-
-
Save toddlucas/b8b80d55af8e837475fbf1ba6efed910 to your computer and use it in GitHub Desktop.
Build multiple app bundles with Gulp and Browserify (vendor bundle not included here)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const paths = { | |
entries: { | |
ts: [ | |
"Scripts/app.ts" | |
] | |
}, | |
... | |
}; | |
/** | |
* Build one or more app bundles that share a common vendor file. | |
* | |
* @returns {MergedStream} Merged stream | |
*/ | |
function app() { | |
const tasks = paths.entries.ts.map(function (entry) { | |
const browse = browserify({ | |
debug: true, | |
entries: [entry] | |
}); | |
return browse | |
.plugin(tsify) | |
.external(paths.input.files.vendors) | |
.bundle() | |
.pipe(source(entry)) | |
.pipe(rename({ | |
dirname: "", | |
extname: ".js" | |
})); | |
}); | |
return es.merge.apply(null, tasks) | |
.pipe(gulp.dest(paths.output.dirs.wwwscripts)) | |
.pipe(buffer()) | |
.pipe(terser()) | |
.pipe(rename({ suffix: '.min' })) | |
.pipe(gulp.dest(paths.output.dirs.wwwscripts)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment