Simplify Your Stylesheets With CSSPrefixer

Woolly, the CSS sheep. CSS 3 has some awesome new features, like 3D transforms, smooth transitions, border images and gradients. Since most browsers already support these features there’s no reason you can’t use them today, provided you gracefully degrade for older browsers. But when it comes to writing CSS 3 there’s no question it can […]

Woolly, the CSS sheep.

CSS 3 has some awesome new features, like 3D transforms, smooth transitions, border images and gradients. Since most browsers already support these features there's no reason you can't use them today, provided you gracefully degrade for older browsers.

But when it comes to writing CSS 3 there's no question it can be a pain. Not only are the new rules considerably more complex than the simple days of background: white, most browsers are still using prefixes for CSS 3 features.

While we think browser prefixing is a good thing, it definitely adds complexity to your stylesheets and means writing the same rule several times. That's where CSSPrefixer comes in. Prefixer is a Python-based CSS processor that takes single CSS 3 declarations and adds all the necessary browser prefixes to your stylesheet. You just write the actual CSS 3 rule and CSSPrefixer does the rest. As an added bonus CSSPrefixer can also compress your stylesheets to save on bandwidth.

Since it's written in Python you can run CSSPrefixer from the shell, from the Python prompt or even integrate it into popular Python frameworks (like Django) using the webassets project, which now supports CSSPrefixer.

If you're tired of wading through half a dozen rules every time you want to write a little CSS 3, use CSSPrefixer to simplify your code.

See Also: