-
Notifications
You must be signed in to change notification settings - Fork 71
feat(js-themes-toolkit): adds js minification step (Fixes #364) #365
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,8 +7,11 @@ | |
|
|
||
| const chalk = require('chalk'); | ||
| const fs = require('fs-extra'); | ||
| const gulpIf = require('gulp-if'); | ||
| const rename = require('gulp-rename'); | ||
| const replace = require('gulp-replace-task'); | ||
| const sourcemaps = require('gulp-sourcemaps'); | ||
| const terser = require('gulp-terser'); | ||
| const _ = require('lodash'); | ||
| const path = require('path'); | ||
| const PluginError = require('plugin-error'); | ||
|
|
@@ -91,6 +94,7 @@ module.exports = function () { | |
| 'build:fix-at-directives', | ||
| 'build:r2', | ||
| 'build:copy:fontAwesome', | ||
| 'build:minify:js', | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait until the very end and then minify all the things. Keep in mind that we don't have a babel step ourselves, but people could configure it on their own, so chances are we're going to break things if that's the case (at least for sourcemaps). |
||
| 'build:war', | ||
| cb | ||
| ); | ||
|
|
@@ -313,6 +317,17 @@ module.exports = function () { | |
| ); | ||
| }); | ||
|
|
||
| gulp.task('build:minify:js', () => { | ||
| const production = process.env.NODE_ENV === 'production'; | ||
|
|
||
| return gulp | ||
| .src(pathBuild.join('**', '*.js').asPosix) | ||
| .pipe(gulpIf(production, sourcemaps.init())) | ||
| .pipe(gulpIf(production, terser(options.terser || {}))) | ||
| .pipe(gulpIf(production, sourcemaps.write('.'))) | ||
| .pipe(gulp.dest(pathBuild)); | ||
| }); | ||
|
|
||
| gulp.task('build:war', (done) => { | ||
| runSequence('plugin:version', 'plugin:war', done); | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7076,6 +7076,16 @@ [email protected]: | |
| through2 "^2.0.0" | ||
| vinyl "^1.0.0" | ||
|
|
||
| gulp-terser@^2.0.0: | ||
| version "2.0.0" | ||
| resolved "https://registry.yarnpkg.com/gulp-terser/-/gulp-terser-2.0.0.tgz#07f95ef9121fe9d4970c3c4ee775c9cd658d0474" | ||
| integrity sha512-8KxzgUpNeLsSujUCrNKUiSI1ioO5TfW4ODhbM+wzNTWgYp7yCIl1c/5EeOI+SOXaNLi+BzzMqrbb0eYMIThFCQ== | ||
| dependencies: | ||
| plugin-error "^1.0.1" | ||
| terser "5.4.0" | ||
| through2 "^4.0.2" | ||
| vinyl-sourcemaps-apply "^0.2.1" | ||
|
|
||
| gulp-util@^3.0, gulp-util@^3.0.0, gulp-util@^3.0.4, gulp-util@^3.0.7, gulp-util@^3.0.8: | ||
| version "3.0.8" | ||
| resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f" | ||
|
|
@@ -12552,7 +12562,7 @@ read-pkg@^5.0.0, read-pkg@^5.2.0: | |
| parse-json "^5.0.0" | ||
| type-fest "^0.6.0" | ||
|
|
||
| "readable-stream@2 || 3", readable-stream@^3.0.6, readable-stream@^3.1.1: | ||
| "readable-stream@2 || 3", readable-stream@3, readable-stream@^3.0.6, readable-stream@^3.1.1: | ||
| version "3.6.0" | ||
| resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" | ||
| integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== | ||
|
|
@@ -14504,6 +14514,15 @@ [email protected], terser@^5.3.8: | |
| source-map "~0.7.2" | ||
| source-map-support "~0.5.19" | ||
|
|
||
| [email protected]: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes me super sad... the fact that
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
And people wonder why I am so grumpy about dependencies... |
||
| version "5.4.0" | ||
| resolved "https://registry.yarnpkg.com/terser/-/terser-5.4.0.tgz#9815c0839072d5c894e22c6fc508fbe9f5e7d7e8" | ||
| integrity sha512-3dZunFLbCJis9TAF2VnX+VrQLctRUmt1p3W2kCsJuZE4ZgWqh//+1MZ62EanewrqKoUf4zIaDGZAvml4UDc0OQ== | ||
| dependencies: | ||
| commander "^2.20.0" | ||
| source-map "~0.7.2" | ||
| source-map-support "~0.5.19" | ||
|
|
||
| terser@^4.6.3: | ||
| version "4.8.0" | ||
| resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17" | ||
|
|
@@ -14590,6 +14609,13 @@ through2@^3.0.0, through2@^3.0.1: | |
| inherits "^2.0.4" | ||
| readable-stream "2 || 3" | ||
|
|
||
| through2@^4.0.2: | ||
| version "4.0.2" | ||
| resolved "https://registry.yarnpkg.com/through2/-/through2-4.0.2.tgz#a7ce3ac2a7a8b0b966c80e7c49f0484c3b239764" | ||
| integrity sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw== | ||
| dependencies: | ||
| readable-stream "3" | ||
|
|
||
| through@2, "through@>=2.2.7 <3", through@^2.3.6, through@^2.3.8, through@~2.3, through@~2.3.4: | ||
| version "2.3.8" | ||
| resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.