valerio0999 valerio0999 - 27 days ago 6
CSS Question

compass removes css comments in compiled css

i really need having my comments compiled in the final css file of my compass project, but all my comments are deleted while compiling.

i tried setting

line_comments = true
in the
config.rb
file and i get the line comments, but not my own comments.

how can i solve this?

i'm using liferay cms, and the outdated version of our css minifier doesn't minify mediaqueries the right way so in production, all my mediaqueries won't work unless i write this little comment:

@media all and /*!YUI compressor*/ (max-width: 480px) {}


is there a way to tell compass not to delete my own comments?
thanks a lot!

Answer

Compass basically uses the SASS settings for comments and output style which are documented here

Basically, it should leave in your block comments, but need to make sure you're not using the compressed output style, otherwise everything will be removed anyway.

If you're not using compressed and your block comments are still being removed, it might be because they're still declared in-line (I'm not sure what behaviour compass has in that regard). Try moving them to the line before like this:

/*!YUI compressor*/
@media all and (max-width: 480px) {}

The line_comments option just outputs comments before each selector saying where that rule is defined in your SCSS file (as long as your not using compressed) , it was useful before compass supported source-maps