aboutsummaryrefslogtreecommitdiffstats
path: root/gulpfile.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-08-09 08:53:34 +0800
committerkumavis <aaron@kumavis.me>2017-08-09 08:53:34 +0800
commit59e83d2b8063e7ef7c57c1fe9a2cd9c846637e20 (patch)
tree5924be836a0f6a70ae4868a1995bbfa821baa230 /gulpfile.js
parent4a4736195f258c44723a87c659f6380d5dd2cfdd (diff)
downloadtangerine-wallet-browser-59e83d2b8063e7ef7c57c1fe9a2cd9c846637e20.tar
tangerine-wallet-browser-59e83d2b8063e7ef7c57c1fe9a2cd9c846637e20.tar.gz
tangerine-wallet-browser-59e83d2b8063e7ef7c57c1fe9a2cd9c846637e20.tar.bz2
tangerine-wallet-browser-59e83d2b8063e7ef7c57c1fe9a2cd9c846637e20.tar.lz
tangerine-wallet-browser-59e83d2b8063e7ef7c57c1fe9a2cd9c846637e20.tar.xz
tangerine-wallet-browser-59e83d2b8063e7ef7c57c1fe9a2cd9c846637e20.tar.zst
tangerine-wallet-browser-59e83d2b8063e7ef7c57c1fe9a2cd9c846637e20.zip
build - factor watcify into bundler generation
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js28
1 files changed, 11 insertions, 17 deletions
diff --git a/gulpfile.js b/gulpfile.js
index 57de37dd9..ac36cf983 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -248,26 +248,27 @@ function zipTask(target) {
}
}
-function generateBundler(opts) {
- var browserifyOpts = assign({}, watchify.args, {
+function generateBundler(opts, performBundle) {
+ const browserifyOpts = assign({}, watchify.args, {
entries: ['./app/scripts/'+opts.filename],
plugin: 'browserify-derequire',
debug: debug,
fullPaths: debug,
})
- return browserify(browserifyOpts)
-}
-
-function discTask(opts) {
- let bundler = generateBundler(opts)
+ let bundler = browserify(browserifyOpts)
if (opts.watch) {
bundler = watchify(bundler)
- // on any dep update, runs the bundler
+ // on any file update, re-runs the bundler
bundler.on('update', performBundle)
}
+ return bundler
+}
+
+function discTask(opts) {
+ const bundler = generateBundler(opts, performBundle)
// output build logs to terminal
bundler.on('log', gutil.log)
@@ -289,14 +290,7 @@ function discTask(opts) {
function bundleTask(opts) {
- let bundler = generateBundler(opts)
-
- if (opts.watch) {
- bundler = watchify(bundler)
- // on any file update, re-runs the bundler
- bundler.on('update', performBundle)
- }
-
+ const bundler = generateBundler(opts, performBundle)
// output build logs to terminal
bundler.on('log', gutil.log)
@@ -316,7 +310,7 @@ function bundleTask(opts) {
throw err
}
})
-
+
// convert bundle stream to gulp vinyl stream
.pipe(source(opts.filename))
// inject variables into bundle