Re: Comment syntax

On Mon, Aug 27, 2012 at 4:44 AM, Kang-Hao (Kenny) Lu
<kanghaol@oupeng.com> wrote:
> (12/08/26 11:10), Zachary “Gamer_Z.” Yaro wrote:
>> I still do not quite see why the existence of minifiers matters here at
>> all.
>
> Well, it means that minimizers have to support //-style comments or it
> will turn out disastrous once Web Developers start to use these without
> updating their CSS minimizer. Also, it seems that CSS minimizers don't
> get update too frequently either (for example, YUI compressor[1] was
> last updated a year ago).
>
> Pragmatically speaking, browsers implementing //-style comments would
> honor much fewer style rules an input like
>
>   //some comments. a {...} div {...} section {...}
>
> (a very likely output from YUI compressor given //-style comments) then
> a browser not implementing //-style, which means that it's more likely
> for users of browsers implementing //-style to see pages broken. In such
> case, users will criticize browsers instead of Web developers or
> developers of the CSS minimizers, and that will be the reason why
> browser implementers don't want to adopt this.

This is the big thing I'm afraid of, and would like a compat study
done for before I could support this.

Right now, you can naively minify just by replacing all runs of
whitespace with a single space.  (The only exception is if you use a \
at the end of a line to create a multi-line string, but this is rare
enough that I wouldn't be surprised if there were plenty of naive
minifiers that didn't take this into account.)  If you use // comments
on your source document, the minified document today will act
identically (the next property will be ignored as invalid).  If we
switched behavior, it would instead remove the entire rest of the
stylesheet.

This is, unfortunately, a problem with *existing* stylesheets, so we
can't just rely on the "well, don't do that" defense.  I'd like a
reasonable assurance that adding this wouldn't cause a significant
number of sites to suddenly break due to this. ^_^

~TJ

Received on Monday, 27 August 2012 22:28:33 UTC