Open kangax opened 9 years ago
If this is a 2-line change to the go
script, sure, I'll take a PR for it.
Rationale: OK, this is just barely worth it. Even in pessimistic circumstances, the 12% savings might mean the difference between waiting 1 minute for the whole document and waiting 1 minute 7 seconds; or it might mean the difference between having a 35% chance of successfully downloading the whole document vs. a 40% chance.
Changing the Python script to spit out minified HTML could likely be done by deleting code, rather than adding it, but an external tool is better. The output from es-spec.py
is pretty-printed on purpose. That way I can use git diff es6-draft.html
to see if the output seems sane, and sometimes get a feel for what's changed.
Honestly, there are other ideas I'd rather see pursued to improve the download speed: change the script to generate multipage output, or a hypothetical fancy new JS-powered page that downloads the text incrementally. Maybe Markdown output, which would be more compact than HTML. But I'll take what I can get!
Re: multipage output, ref. https://github.com/jorendorff/es-spec-html/issues/5.
@jorendorff To install the HTML minifier dependency using npm:
npm install html-minifier -g
Then, every time you build a new version of es6-draft.html
, run this command:
html-minifier --collapse-whitespace --remove-attribute-quotes --remove-redundant-attributes --prevent-attributes-escaping --use-short-doctype --remove-optional-tags es6-draft.html > es6-draft-minified.html
I can submit a PR that adds this info to the README, but it might be better to create a build.sh
or Makefile
that includes this command and recommend using that in the README.
I ran the entire page through my html-minifier — ES6 spec seems like a perfect candidate for it.
Here's the result:
Second colum is (more representative) gzipped comparison. So it's pure savings of 50KB (already accounting for gzip which is how the page is transferred) and it only takes ~3 sec to minify it as a one-time task.
There should be no differences in rendering.
What do you think? Worth it?