diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 03b25a6..2d6feea 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -13,6 +13,11 @@ import fs from 'fs' import yaml from 'js-yaml' import request from 'request' +// required to get our mix of old and ES6+ js to work with ugify-js 3 +import uglifyjs from 'uglify-es' +import composer from 'gulp-uglify/composer' +const minify = composer(uglifyjs, console) + // get all the configs: `pkg` and `site` import pkg from './package.json' const site = yaml.safeLoad(fs.readFileSync('./_config.yml')) @@ -196,7 +201,7 @@ export const js = () => .pipe($.include({ includePaths: ['node_modules', SRC + '_assets/javascripts'] })).on('error', onError) - .pipe($.if(isProduction || isStaging, $.uglify())).on('error', onError) + .pipe($.if(isProduction || isStaging, minify())).on('error', onError) .pipe($.if(!(isProduction || isStaging), $.sourcemaps.write())) .pipe($.if(isProduction || isStaging, $.header(BANNER, { pkg: pkg }))) .pipe($.rename({suffix: '.min'})) diff --git a/package.json b/package.json index e65cdb8..4ba350e 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,8 @@ "gulp-uglify": "^3.0.0", "gulp-util": "^3.0.6", "js-yaml": "^3.8.3", - "request": "^2.81.0" + "request": "^2.81.0", + "uglify-es": "^3.0.13" }, "engines": { "node": ">=7.0.0"