From 17092d661ba093dea92fc1cdd20910f2326237a8 Mon Sep 17 00:00:00 2001 From: Fabrizio Fortunato Date: Mon, 19 Jun 2017 22:00:47 +0100 Subject: [PATCH] feat(umd): uglify the umd bundle --- generators/app/templates/_package.json | 1 + generators/app/templates/gulpfile.js | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/generators/app/templates/_package.json b/generators/app/templates/_package.json index be89dfb..6845029 100644 --- a/generators/app/templates/_package.json +++ b/generators/app/templates/_package.json @@ -55,6 +55,7 @@ "node-watch": "^0.5.2", "protractor": "~5.1.0", "rollup": "^0.41.6", + "rollup-plugin-uglify": "^2.0.1", "run-sequence": "^1.2.2", "rxjs": "^5.1.0", "ts-node": "~2.0.0", diff --git a/generators/app/templates/gulpfile.js b/generators/app/templates/gulpfile.js index 770f1ec..6f60b43 100644 --- a/generators/app/templates/gulpfile.js +++ b/generators/app/templates/gulpfile.js @@ -6,7 +6,8 @@ var gulp = require('gulp'), rename = require('gulp-rename'), del = require('del'), runSequence = require('run-sequence'), - inlineResources = require('./tools/gulp/inline-resources'); + inlineResources = require('./tools/gulp/inline-resources'), + uglify = require('rollup-plugin-uglify'); const rootFolder = path.join(__dirname); const srcFolder = path.join(rootFolder, 'src'); @@ -136,8 +137,14 @@ gulp.task('rollup:umd', function () { // See https://github.com/rollup/rollup/wiki/JavaScript-API#globals globals: { typescript: 'ts' - } - + }, + + // https://github.com/TrySound/rollup-plugin-uglify to uglify the .umd + // For all the options you can have a look at + // https://github.com/mishoo/UglifyJS2#api-reference + plugins: [ + uglify() + ] })) .pipe(rename('<%= props.libraryName.kebabCase %>.umd.js')) .pipe(gulp.dest(distFolder));