format of comment to survive minification

22 views
Skip to first unread message

Nick Levinson

unread,
Jun 29, 2015, 9:34:23 PM6/29/15
to pagespeed-ins...@googlegroups.com
Where do I post to ask Google to support a change to the HTML5 specification, since it affects Google's advice to us?

You suggest minification to speed page loading by removing comments (and other unnecessaries), but some comments should remain to be available in HTML5 pages in a live website. For example, the AdSense code I got from Google includes a comment that Google presumably wants me to leave in the website pages where installed. However, apparently minification generally is indiscriminate in removing all comments, so that manual intervention is necessary for selectivity, and that can be time-consuming or else it discourages minification and thus discourages speeding page loading, thus lowering users' experience with a website to less positive.

I recommended that HTML5 include a different format or a format enhancement for comments that are meant to survive minification. But at the W3C HTML5 specification website this was objected to, partly on the ground that "there is pretty much zero chance of such of a redundant other comment-markup feature ever getting added to HTML." So far, only two of us have commented on the bug report, so the vote, were there a vote, would be 1-1. The status is presently "WONTFIX". The HTML5 enhancement request is at https://www.w3.org/Bugs/Public/show_bug.cgi?id=28832 and is open for comments and a status change.

I haven't addressed CSS comment formatting and I'm not familiar with JavaScript coding, but those probably should be considered, too, given Google's advice to minify them as well.

Google's advice to minify is at <https://developers.google.com/speed/docs/insights/MinifyResources>, as accessed June 27, 2015.

Should I post somewhere else? Thanks.

Rick Steinwand

unread,
Jul 2, 2015, 9:18:59 AM7/2/15
to pagespeed-ins...@googlegroups.com
I can save you a lot of work.

The answer is pretty easy. Minification is optional. Minify what you want. The more you minify, the better results you get, but you're talking about a very small benefit for the few comments you feel you need to leave on the page.

To be honest, if you use gzip compression, you can save more in other areas, like images or reducing the number of external files a page needs to download.

Nick Levinson

unread,
Jul 5, 2015, 10:36:51 PM7/5/15
to pagespeed-ins...@googlegroups.com
That's for manual minification and if you have a lot of files you'll likely do it automatically or not at all. Thus, for cases where Google recommends minification (Google also recommends compression and the two are not usually mutually exclusive), something is needed in the comment to tell a minifier tool not to minify this comment. Suggestions for persuading W3C?
Reply all
Reply to author
Forward
0 new messages