YUI Compressor and CSS content?

css, minify, yui, yui-compressor

Solution

As a workaround, try using unicode entity instead of space character itself:

.author-name:before {content: "by:\00A0"; }

`\00A0` in particular is non-breaking space.

Problem

I have a stylesheet with the following code: ``` .author-name:before { content:"by: "; } ``` When I run this through YUI Compressor, I get: ``` .author-name:before{content:"by:"} ``` This is a problem because it wipes out intended whitespace. I thought using the YUI Compressor special comments, like this: ``` .author-name:before { /*!YUI-Compressor */content: "by: "; } ``` ... might help, but it seems not to. Additionally, the comments themselves got wiped out. My impression based on the was that comments in JavaScript that start with `/*!` get preserved, but that's not actually happening. Short of post-processing my build process to unminify, is there a way to do this? We're currently using version 2.3.5 of YUI compressor, and running with the flags `--charset utf8 -v -o` So my question, in short, is, is there a way to get YUI Compressor to respect spaces in `content:` values, or a way to add CSS comments before and after a block I don't want minified?

Original source