Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(umd): uglify the umd bundle #134

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions generators/app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"gulp": "^3.9.1",
"gulp-rename": "^1.2.2",
"gulp-rollup": "^2.15.0",
"gulp-uglify": "^3.0.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
Expand All @@ -60,6 +61,7 @@
"node-sass-tilde-importer": "^1.0.0",
"node-watch": "^0.5.2",
"protractor": "~5.1.2",
"pump": "^1.0.2",
"rollup": "^0.49.3",
"run-sequence": "^1.2.2",
"rxjs": "^5.5.2",
Expand Down
13 changes: 12 additions & 1 deletion generators/app/templates/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ var gulp = require('gulp'),
path = require('path'),
ngc = require('@angular/compiler-cli/src/main').main,
rollup = require('gulp-rollup'),
uglify = require('gulp-uglify'),
pump = require('pump'),
rename = require('gulp-rename'),
del = require('del'),
runSequence = require('run-sequence'),
Expand Down Expand Up @@ -131,12 +133,20 @@ gulp.task('rollup:umd', function () {
globals: {
typescript: 'ts'
}

}))
.pipe(rename('<%= props.libraryName.kebabCase %>.umd.js'))
.pipe(gulp.dest(distFolder));
});

gulp.task('uglify', function (cb) {
pump([
gulp.src(`${distFolder}/<%= props.libraryName.kebabCase %>.umd.js`),
uglify(),
rename('<%= props.libraryName.kebabCase %>.umd.min.js'),
gulp.dest(distFolder)
], cb);
});

/**
* 7. Copy all the files from /build to /dist, except .js files. We ignore all .js from /build
* because with don't need individual modules anymore, just the Flat ES module generated
Expand Down Expand Up @@ -185,6 +195,7 @@ gulp.task('compile', function () {
'ngc',
'rollup:fesm',
'rollup:umd',
'uglify',
'copy:build',
'copy:manifest',
'copy:readme',
Expand Down