peteboere / css-crush

CSS preprocessor.
http://the-echoplex.net/csscrush
MIT License
537 stars 51 forks source link

The @charset rule should appear at the very beginning of the generated file #35

Closed ghost closed 12 years ago

ghost commented 12 years ago

Hi,

I have a CSS file with comments written with accentuated characters (file encoded in UTF-8) and though I declared the charset to use as UTF-8 with the at-rule @charset, in the browser view source function, characters are misinterpreted.

Here's an example CSS:

@charset "UTF-8";

/**
    @author Marc-André Joyal
    @date 15 août 2012

*/

root { 
    display: block;
}

And the generated CSS from the view source function:

/*
 * CSS Crush(ed) on 2012-08-15 14:56:58 -0400
 * http://github.com/peteboere/css-crush (v1.6.0)
 */
@charset "UTF-8"
;/**
    @author Marc-André Joyal
    @date 15 août 2012

*/

root {
    display: block;
    }

As per the W3C documentation, the charset at-rule should appear at the very start of the document.

Best Regards

peteboere commented 12 years ago

Yep, I'll definitely look at getting this fixed.

In the meantime you can disable the output boilerplate so the charset directive is before anything else.