Skip to content

Commit

Permalink
make min version of more outputted files
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Oct 30, 2016
1 parent d9661b3 commit ef3c4f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ gulp.task('default', [ 'dist' ]);

// everything needed for running demos and developing
gulp.task('dev', [
'modules',
'modules:dev',
'locale'
]);

Expand Down
10 changes: 7 additions & 3 deletions tasks/archive.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,13 @@ function transformDemoPath(path) {
// reroot dist files to archive root
path = path.replace('../dist/', '../');

// always use minified
// won't mutate .print.css thankfully
path = path.replace(/\/([^\.]+)\.(js|css)/, '/$1.min.$2');
if (
!/\.min\.(js|css)$/.test(path) && // not already minified
path !== '../locale-all.js' // this file is already minified
) {
// use minified
path = path.replace(/\/([^\/]*)\.(js|css)$/, '/$1.min.$2');
}

return path;
}
3 changes: 2 additions & 1 deletion tasks/minify.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ gulp.task('minify:clean', function() {
gulp.task('minify:js', [ 'modules' ], function() {
return gulp.src([
'dist/*.js',
'!dist/*.min.js' // avoid double minify
'!dist/*.min.js', // avoid double minify
'!dist/locale-all.js' // already minified
])
.pipe(uglify({
preserveComments: 'some' // keep comments starting with !
Expand Down

0 comments on commit ef3c4f4

Please sign in to comment.