valerio0999
valerio0999

Reputation: 12136

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!

Upvotes: 1

Views: 8711

Answers (3)

Pbinder
Pbinder

Reputation: 470

Updating to last Sass version fixes the issue. Now it keeps loud comments in compressed output files. Be sure that you have the at least Sass 3.4.22 with this command:

sass -v

Upvotes: 0

SVS
SVS

Reputation: 4275

Here is my way of removing comments from compiled CSS is:

Use // to all the comments you don't want to be shown after compilation

Use /* */ normal CSS comments for comments you want to see in your compiled CSS.

For example, You don't want to show the comments of Grid mixins just add // before the normal css comments

///*=============== Grid Mixins =================*/

Upvotes: 5

Jason C
Jason C

Reputation: 50

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

Upvotes: 2

Related Questions