aboutsummaryrefslogtreecommitdiffstats
path: root/gulpfile.js
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2016-09-03 05:00:36 +0800
committerKevin Serrano <kevgagser@gmail.com>2016-09-03 05:00:36 +0800
commitb4334a72b45d18c4985c1882f5da7ad4a1b907df (patch)
treef7ccd1977d7d707fcf1f0b62d3722019a5ad76c7 /gulpfile.js
parentc02be4fa66a037bd23fb5d51759b6d4a7486bf6e (diff)
downloadtangerine-wallet-browser-b4334a72b45d18c4985c1882f5da7ad4a1b907df.tar
tangerine-wallet-browser-b4334a72b45d18c4985c1882f5da7ad4a1b907df.tar.gz
tangerine-wallet-browser-b4334a72b45d18c4985c1882f5da7ad4a1b907df.tar.bz2
tangerine-wallet-browser-b4334a72b45d18c4985c1882f5da7ad4a1b907df.tar.lz
tangerine-wallet-browser-b4334a72b45d18c4985c1882f5da7ad4a1b907df.tar.xz
tangerine-wallet-browser-b4334a72b45d18c4985c1882f5da7ad4a1b907df.tar.zst
tangerine-wallet-browser-b4334a72b45d18c4985c1882f5da7ad4a1b907df.zip
Refactor for spreading. Add conditionals for livereload.
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js30
1 files changed, 24 insertions, 6 deletions
diff --git a/gulpfile.js b/gulpfile.js
index 2f2722a3b..ad87586e5 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -19,7 +19,7 @@ var manifest = require('./app/manifest.json')
var gulpif = require('gulp-if')
var replace = require('gulp-replace')
-var production = false
+var production = gutil.env.production
// browser reload
@@ -98,7 +98,20 @@ gulp.task('manifest:production', function() {
.pipe(gulp.dest('./dist/', { overwrite: true }))
})
-gulp.task('copy', gulp.series(gulp.parallel('copy:locales','copy:images','copy:fonts','copy:reload','copy:root'), 'manifest:production', 'manifest:chrome'))
+const staticFiles = [
+ 'locales',
+ 'images',
+ 'fonts',
+ 'root'
+]
+
+var copyStrings = staticFiles.map(staticFile => `copy:${staticFile}`)
+
+if (!production) {
+ copyStrings.push('copy:`reload`')
+}
+
+gulp.task('copy', gulp.series(gulp.parallel(...copyStrings), 'manifest:production', 'manifest:chrome'))
gulp.task('copy:watch', function(){
gulp.watch(['./app/{_locales,images}/*', './app/scripts/chromereload.js', './app/*.{html,json}'], gulp.series('copy'))
})
@@ -132,14 +145,18 @@ const jsFiles = [
'popup',
]
+var jsDevStrings = jsFiles.map(jsFile => `dev:js:${jsFile}`)
+var jsBuildStrings = jsFiles.map(jsFile => `build:js:${jsFile}`)
+
jsFiles.forEach((jsFile) => {
gulp.task(`dev:js:${jsFile}`, bundleTask({ watch: true, filename: `${jsFile}.js` }))
gulp.task(`build:js:${jsFile}`, bundleTask({ watch: false, filename: `${jsFile}.js` }))
})
-gulp.task('dev:js', gulp.parallel('dev:js:inpage','dev:js:contentscript','dev:js:background','dev:js:popup'))
+gulp.task('dev:js', gulp.parallel(...jsDevStrings))
+
+gulp.task('build:js', gulp.parallel(...jsBuildStrings))
-gulp.task('build:js', gulp.parallel('build:js:inpage','build:js:contentscript','build:js:background','build:js:popup'))
// clean dist
@@ -169,6 +186,7 @@ gulp.task('zip', gulp.parallel('zip:chrome', 'zip:firefox', 'zip:edge'))
// high level tasks
gulp.task('dev', gulp.series('dev:js', 'copy', gulp.parallel('copy:watch', 'dev:reload')))
+
gulp.task('build', gulp.series('clean', gulp.parallel('build:js', 'copy')))
gulp.task('dist', gulp.series('build', 'zip'))
@@ -187,7 +205,7 @@ function copyTask(opts){
destinations.forEach(function(destination) {
stream = stream.pipe(gulp.dest(destination))
})
- stream.pipe(livereload())
+ stream.pipe(gulpif(production,livereload()))
return stream
}
@@ -228,7 +246,7 @@ function bundleTask(opts) {
.pipe(gulp.dest('./dist/firefox/scripts'))
.pipe(gulp.dest('./dist/chrome/scripts'))
.pipe(gulp.dest('./dist/edge/scripts'))
- .pipe(livereload())
+ .pipe(gulpif(!production,livereload()))
)
}