0

MD WebUI: Uglify vulcanized javascript bundles to remove comments/whitespace

We run uglify in 'beautify' mode so that output is still human-readable,
but comments and whitespace are removed. This reduces the size of
resources.pak by 330K.

BUG=629406,638624
NOPRESUBMIT=true # crisper.js
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2257723002
Cr-Commit-Position: refs/heads/master@{#413070}
This commit is contained in:
tsergeant
2016-08-18 23:39:36 -07:00
committed by Commit bot
parent 25f67c81bf
commit ce13eef039
4 changed files with 9986 additions and 21863 deletions
chrome/browser/resources
docs

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -85,6 +85,13 @@ def _vulcanize(directory, host, html_in_file, html_out_file='vulcanized.html',
'--script-in-head', 'false',
'--html', html_out_path,
'--js', js_out_path])
# TODO(tsergeant): Remove when JS resources are minified by default:
# crbug.com/619091.
_run_cmd(['uglifyjs', js_out_path,
'--beautify', 'indent-level=2,quote_style=3',
'--comments', '/Copyright|license|LICENSE|\<\/?if/',
'--output', js_out_path])
finally:
os.remove(tmp.name)

@ -12,6 +12,7 @@ Vulcanization currently requires:
- npm: >= 1.3.10 (can be found with `npm --version`)
- vulcanize: 1.14.8 (can be found with `vulcanize --version`)
- crisper: 2.0.1 (can be found with `npm list -g crisper`)
- uglifyjs: 2.4.10 (can be found with `uglifyjs --version`)
## Installing required software
@ -30,8 +31,8 @@ Then install the required modules:
$ npm install -g crisper vulcanize
```
Ultimately, all that is required to run this script is that `crisper` and
`vulcanize` are on your `$PATH`.
Ultimately, all that is required to run this script is that `crisper`, 'uglify'
and `vulcanize` are on your `$PATH`.
## Combining resources with vulcanize