Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Issue 2252963002: MD WebUI: Strip comments from vulcanized JS files (Closed)

Created:
4 years, 4 months ago by tsergeant
Modified:
4 years, 4 months ago
Reviewers:
Dan Beam, michaelpg
CC:
arv+watch_chromium.org, asanka, chrome-apps-syd-reviews_chromium.org, chromium-reviews, dbeam+watch-history_chromium.org, dbeam+watch-downloads_chromium.org, Patrick Dubroy, michaelpg+watch-md-ui_chromium.org, pam+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@history_vulcanize
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

MD WebUI: Strip comments from vulcanized JS files This adds a simple JS processor to the vulcanize script which strips most comments from the javascript output. In the interest of simplicity and correctness, it deliberately does not attempt to strip every comments. However, the result is still enough to reduce the size of resources.pak by almost 300Kb. BUG=629406 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Patch Set 1 #

Patch Set 2 : Python lint #

Patch Set 3 : Fix comments ending in **/ #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+48 lines, -7932 lines) Patch
M chrome/browser/resources/md_downloads/crisper.js View 1 2 379 chunks +9 lines, -3516 lines 0 comments Download
M chrome/browser/resources/md_history/app.crisper.js View 1 2 530 chunks +11 lines, -4416 lines 0 comments Download
M chrome/browser/resources/vulcanize.py View 1 2 3 chunks +28 lines, -0 lines 2 comments Download

Depends on Patchset:

Messages

Total messages: 14 (7 generated)
tsergeant
PTAL. Doing this manually works almost as well as uglify (which saves an extra 40K ...
4 years, 4 months ago (2016-08-17 05:18:19 UTC) #7
michaelpg
I think it's extremely... brave... to add a hand-rolled comment parser to a manually-run script... ...
4 years, 4 months ago (2016-08-17 07:39:56 UTC) #9
tsergeant
Surely a manually-run script is better for this than an automatic one? It's easy to ...
4 years, 4 months ago (2016-08-17 07:57:52 UTC) #10
Dan Beam
wait, why not uglify? because it munges too hard?
4 years, 4 months ago (2016-08-17 17:42:58 UTC) #11
tsergeant
On 2016/08/17 17:42:58, Dan Beam wrote: > wait, why not uglify? because it munges too ...
4 years, 4 months ago (2016-08-18 00:07:36 UTC) #12
Dan Beam
On 2016/08/18 00:07:36, tsergeant wrote: > On 2016/08/17 17:42:58, Dan Beam wrote: > > wait, ...
4 years, 4 months ago (2016-08-18 01:46:40 UTC) #13
tsergeant
4 years, 4 months ago (2016-08-18 05:23:15 UTC) #14
On 2016/08/18 01:46:40, Dan Beam wrote:
> On 2016/08/18 00:07:36, tsergeant wrote:
> > On 2016/08/17 17:42:58, Dan Beam wrote:
> > > wait, why not uglify?  because it munges too hard?
> > 
> > Yeah, uglify completely rewrites the file according to its own style rules.
I
> > was worried that this was going to cause a lot of churn in the crisper file,
> > where small changes in input could cause big changes in output because of
> uglify
> > deciding to move things around. Manually stripping comments should be more
> > reproducible and closer to the source input.
> > 
> > In practice, there's probably not much difference and uglify gives slightly
> > better minification, so ¯\_(ツ)_/¯
> 
> can we just use uglify --source-map and maybe check in the source map?

Chatting to Chris, we've decided to go with Uglify. I don't think there's any
particular need for source maps (the output is still human-readable), but that
might be something useful to think about in the future.

I'll send a separate CL for uglify.

Powered by Google App Engine
This is Rietveld 408576698