Re: [CSS21] enhancement: comment format for surviving file being minified

On Sat, Jun 20, 2015 at 10:12 PM, Nick Levinson <nick_levinson@yahoo.com> wrote:
> Hopefully, this is not a duplicate email (I thought I sent one a few minutes ago but apparently not).
>
> Minifying removes comments some of which should, however, stay in place for the benefit of website visitors. We need a comment format that minifiers will recognize for preserving selected comments. For example, I use comments for information that is not important enough to display on a Web page but should be available to someone willing to look in the source code, such as legal information. An example of that is humanly readable copyright information that applies only to the source code and not to the displayed object code itself. This should apply to all CSS that is used in level 3.

Minified code isn't meant to be read in the first place.  The best
practice here is to keep the readable version on the site too (just
not linked to) and use a Source Map (generated by your pipeline) to
translate between the two.

Here's an example of using source maps in Sass
<http://thesassway.com/intermediate/using-source-maps-with-sass> and
here's a description of the source format
<http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/>
(it's written for JS, but it applies to CSS just as well).

Or, according to Michiel, you can apparently use the de-facto standard
of putting a bang right after the comment opening token.

~TJ

Received on Saturday, 11 July 2015 00:03:45 UTC