From 87fc3a9e16e698f7a33e71a7117d5963e57500cd Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Sat, 8 Oct 2016 13:31:19 +0100 Subject: [PATCH] Ensure all Javascript is served compressed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously we were running the minification before adding dependencies. This meant that dependencies that don’t come with a minified version were being served in full. Running Uglify over everything _after_ including the dependencies reduces the weight of the downloaded Javascript by about 50kb. --- gulpfile.babel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 273ca84f8..d6356a587 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -69,7 +69,6 @@ gulp.task('javascripts', () => gulp .pipe(plugins.babel({ presets: ['es2015'] })) - .pipe(plugins.uglify()) .pipe(plugins.addSrc.prepend([ paths.npm + 'hogan.js/dist/hogan-3.0.2.js', paths.npm + 'jquery/dist/jquery.min.js', @@ -77,6 +76,7 @@ gulp.task('javascripts', () => gulp paths.npm + 'diff-dom/diffDOM.js', paths.npm + 'timeago/jquery.timeago.js' ])) + .pipe(plugins.uglify()) .pipe(plugins.concat('all.js')) .pipe(gulp.dest(paths.dist + 'javascripts/')) );