aboutsummaryrefslogtreecommitdiffstats
path: root/gulpfile.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-03-31 13:19:02 +0800
committerkumavis <aaron@kumavis.me>2018-03-31 13:19:02 +0800
commitbd6f5547667bdae00e8990551f3a0ea39ab8d971 (patch)
tree497588b3fb79fa40e800090b4e6fc31dd136fea4 /gulpfile.js
parentee1acf0a7ea490e4d22efdf22dec984cd7ba6a6a (diff)
downloadtangerine-wallet-browser-bd6f5547667bdae00e8990551f3a0ea39ab8d971.tar
tangerine-wallet-browser-bd6f5547667bdae00e8990551f3a0ea39ab8d971.tar.gz
tangerine-wallet-browser-bd6f5547667bdae00e8990551f3a0ea39ab8d971.tar.bz2
tangerine-wallet-browser-bd6f5547667bdae00e8990551f3a0ea39ab8d971.tar.lz
tangerine-wallet-browser-bd6f5547667bdae00e8990551f3a0ea39ab8d971.tar.xz
tangerine-wallet-browser-bd6f5547667bdae00e8990551f3a0ea39ab8d971.tar.zst
tangerine-wallet-browser-bd6f5547667bdae00e8990551f3a0ea39ab8d971.zip
build - use uglifyify and gulp-multi-process for better performance
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js29
1 files changed, 17 insertions, 12 deletions
diff --git a/gulpfile.js b/gulpfile.js
index 1eb0a974b..3a3725c0a 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -28,8 +28,14 @@ const uglify = require('gulp-uglify-es').default
const babel = require('gulp-babel')
const debug = require('gulp-debug')
const pify = require('pify')
+const gulpMultiProcess = require('gulp-multi-process')
const endOfStream = pify(require('end-of-stream'))
+function gulpParallel (...args) {
+ return function spawnGulpChildProcess(cb) {
+ return gulpMultiProcess(args, cb, true)
+ }
+}
const browserPlatforms = [
'firefox',
@@ -418,7 +424,7 @@ gulp.task('build',
gulp.series(
'clean',
'build:scss',
- gulp.parallel(
+ gulpParallel(
'build:extension:js',
'build:mascara:js',
'copy'
@@ -476,6 +482,16 @@ function generateBundler(opts, performBundle) {
let bundler = browserify(browserifyOpts)
+ // Minification
+ if (opts.minifyBuild) {
+ bundler.transform('uglifyify', {
+ global: true,
+ mangle: {
+ reserved: [ 'MetamaskInpageProvider' ]
+ },
+ })
+ }
+
if (opts.watch) {
bundler = watchify(bundler)
// on any file update, re-runs the bundler
@@ -544,7 +560,6 @@ function bundleTask(opts) {
// buffer file contents (?)
.pipe(buffer())
-
// Initialize Source Maps
if (opts.buildSourceMaps) {
buildStream = buildStream
@@ -552,16 +567,6 @@ function bundleTask(opts) {
.pipe(sourcemaps.init({ loadMaps: true }))
}
- // Minification
- if (opts.minifyBuild) {
- buildStream = buildStream
- .pipe(uglify({
- mangle: {
- reserved: [ 'MetamaskInpageProvider' ]
- },
- }))
- }
-
// Finalize Source Maps (writes .map file)
if (opts.buildSourceMaps) {
buildStream = buildStream