CCSS is a preprocessor/pretty-printer for CSS (Cascading Style Sheets), extending the language with support for variables and arithmetic. Version 1.5 of is out now, and is already available in OPAM, for your convenience.

This version features support for @keyframes (CSS3 animations). And of course, you may take advantage of CCSS's variables to make your keyframe declarations easier to maintain. Consider, for example, the source below:

Inflexion_point: 50%;
@keyframes test
{
from                    {opacity: 0;}
Inflexion_point         {opacity: 0.5;}
Inflexion_point + 1%    {opacity: 0.6;}
to                      {opacity: 1;}
}

And the corresponding output from CCSS:

@keyframes test
{
from
{
opacity: 0;
}
50%
{
opacity: 0.5;
}
51%
{
opacity: 0.6;
}
to
{
opacity: 1;
}
}

This version also brings a change to the internal AST representation that though minor, is bound to raise a few eyebrows, and thus requires a brief explanation. In CSS, the @charset at-rule is special in the sense that if present, it may only appear at the very start of the file. In previous versions, CCSS's AST encoded this requirement by treating @charset differently than other at-rules. In this new version, this is no longer the case. The end result is a cleaner and more concise AST, but it does mean that CCSS will now accepted @charset statements beyond the start of the file.

Before you cry "regression", bear in mind that CCSS was never meant to be a standards compliant CSS parser nor a CSS lint. The tool will happily accept semantically meaningless CSS while simultaneously rejecting perfectly valid CSS (it requires declaration blocks to always be terminated by a semicolon, for example, which the standard does not). Therefore, making CCSS slightly less standards-compliant is a viable option if the upside is a simpler, saner, and easier to maintain grammar. Having said that, in practice you won't find many incompatibilities, and I'll happily fix any egregious ones.