Extending the CSS syntax

Note: These extensions will never be turned on by default in cssprepare. You must make a conscious choice to use them. But do take a moment to consider if you really need the extensions before using them. Once you start, you may no longer be writing valid CSS. This means that other parsers and tools (and web browsers for that matter) will not understand your code unless it has been run through cssprepare first.

Line-level comments

CSS lacks line-level comments, only having block-level /* */ style comments. This makes it difficult to comment out sections of a style sheet that have comments/documentation in. Ideally line-level comments should be used to explain code, and block-level comments used to temporarily eliminate entire blocks of code.

Enabling the extended syntax features of cssprepare adds the ability to use // style line-level comments. Anything from the double-slash to the end of that line of a file will be ignored, exactly as if it were surrounded by normal /* and */ comment markers. For example:

#nav li:after {
    content: '*';           // visual separation between items
    _padding-right: 10px;   // use spacing instead in old IEs
}