Disable gzip and source maps for production builds

This disables sourcemap generation for production builds to save on
disk space. While useful, source maps are several times larger than
our actual used code, so it's best to only keep them around during
development.

This also turns off gzip, since it is just duplicating files for now;
we'll want to reconsider this feature once StackViz is building inside
the gate if links start breaking.

Change-Id: Ie4c2735c08014f417b8f1f68fc8f6b9e4898dff2
This commit is contained in:
Tim Buckley 2016-05-13 18:40:17 -06:00
parent 28caae17d6
commit d2e9ad4fca
2 changed files with 17 additions and 1 deletions

14
gulp/tasks/cleanMaps.js Normal file
View File

@ -0,0 +1,14 @@
'use strict';
var config = require('../config');
var gulp = require('gulp');
var del = require('del');
var path = require('path');
gulp.task('cleanmaps', function(cb) {
// It seems to be impossible to disable sourcemaps normally. Instead, delete
// them at the end of 'prod'.
return del([path.join(config.scripts.dest, 'main.js.map')]);
});

View File

@ -9,6 +9,8 @@ gulp.task('prod', ['clean'], function(cb) {
global.isProd = true;
runSequence(['styles', 'fonts', 'views'], 'browserify', 'gzip', cb);
runSequence(
['styles', 'fonts', 'views'],
'browserify', 'cleanmaps', cb);
});