[NewUI] Build mascara with uglification and gzipping. (#2735)

* Adds uglification and gzipping.

* Build mascara with uglification and gzipping.

* Remove gzipping from extension build.
feature/default_network_editable
Dan J Miller 7 years ago committed by Alexander Tseung
parent b8310ac62e
commit 41057a76c5
  1. 7
      gulpfile.js
  2. 3
      mascara/server/index.js
  3. 4
      mascara/server/util.js
  4. 2
      package.json

@ -23,6 +23,8 @@ var sass = require('gulp-sass')
var autoprefixer = require('gulp-autoprefixer')
var gulpStylelint = require('gulp-stylelint')
var stylefmt = require('gulp-stylefmt')
var uglify = require('gulp-uglify')
var babel = require('gulp-babel')
var disableDebugTools = gutil.env.disableDebugTools
@ -375,6 +377,11 @@ function bundleTask(opts) {
// sourcemaps
// loads map from browserify file
.pipe(gulpif(debug, sourcemaps.init({ loadMaps: true })))
// Minification
.pipe(babel({
presets: ['env']
}))
.pipe(uglify())
// writes .map file
.pipe(gulpif(debug, sourcemaps.write('./')))
// write completed bundles

@ -2,6 +2,7 @@ const path = require('path')
const express = require('express')
const createBundle = require('./util').createBundle
const serveBundle = require('./util').serveBundle
const compression = require('compression')
module.exports = createMetamascaraServer
@ -16,6 +17,8 @@ function createMetamascaraServer () {
// serve bundles
const server = express()
server.use(compression())
// ui window
serveBundle(server, '/ui.js', uiBundle)
server.use(express.static(path.join(__dirname, '/../ui/'), { setHeaders: (res) => res.set('X-Frame-Options', 'DENY') }))

@ -23,7 +23,9 @@ function createBundle (entryPoint) {
cache: {},
packageCache: {},
plugin: [watchify],
}).transform('babelify')
})
.transform('babelify')
.transform('uglifyify', { global: true })
bundler.on('update', bundle)
bundle()

@ -199,6 +199,7 @@
"eth-json-rpc-middleware": "^1.2.7",
"fs-promise": "^2.0.3",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-babel": "^7.0.0",
"gulp-if": "^2.0.1",
"gulp-json-editor": "^2.2.1",
"gulp-livereload": "^3.8.1",
@ -206,6 +207,7 @@
"gulp-sourcemaps": "^2.6.0",
"gulp-stylefmt": "^1.1.0",
"gulp-stylelint": "^4.0.0",
"gulp-uglify": "^3.0.0",
"gulp-util": "^3.0.7",
"gulp-watch": "^4.3.5",
"gulp-zip": "^4.0.0",

Loading…
Cancel
Save