From b0b1e08a67976e5b93fdbfa0224910207fb711b4 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Wed, 29 May 2019 02:42:53 -0600 Subject: [PATCH] only bundle vendor scripts that end with .bundle.js --- gulp.d/tasks/build.js | 12 ++++++++++-- src/js/vendor/{highlight.js => highlight.bundle.js} | 0 2 files changed, 10 insertions(+), 2 deletions(-) rename src/js/vendor/{highlight.js => highlight.bundle.js} (100%) diff --git a/gulp.d/tasks/build.js b/gulp.d/tasks/build.js index 509c275..e5f9e86 100644 --- a/gulp.d/tasks/build.js +++ b/gulp.d/tasks/build.js @@ -52,8 +52,16 @@ module.exports = (src, dest, preview) => () => { .pipe( // see https://gulpjs.org/recipes/browserify-multiple-destination.html map((file, enc, next) => { - file.contents = browserify(file.relative, { basedir: src, detectGlobals: false }).bundle() - next(null, file) + if (file.relative.endsWith('.bundle.js')) { + file.contents = browserify(file.relative, { basedir: src, detectGlobals: false }).bundle() + file.path = file.path.slice(0, file.path.length - 10) + '.js' + next(null, file) + } else { + fs.readFile(file.path, 'UTF-8').then((contents) => { + file.contents = Buffer.from(contents) + next(null, file) + }) + } }) ) .pipe(buffer()) diff --git a/src/js/vendor/highlight.js b/src/js/vendor/highlight.bundle.js similarity index 100% rename from src/js/vendor/highlight.js rename to src/js/vendor/highlight.bundle.js -- 2.11.0