If you have had anything to do with CSS, you must already be fully aware of the importance of a preprocessor. In simple words, a preprocessor brings peace of mind and ease of use to the coder’s table. It lets you write code that is both future-ready and easily maintainable, thereby saving both your time and energy.
Of course, in simple CSS tweaks, a preprocessor might not always be needed. However, if you are dealing with gigantic stylesheets and numerous rules of style and code, a preprocessor can indeed come handy and improve your overall code manifolds, especially in terms of comprehension and legibility.
In this post, I have put together some of the best CSS preprocessors that are available out there.
Arguably the most well known CSS preprocessor out there, Sass has been around for nearly eight years, and as such, it is no minnow when it comes to preprocessors.
Sass requires Ruby to work with, and offers two syntaxes: the original Sass, and the relatively new but steadily rising in popularity, SCSS.
Owing to its simplicity and reductionist approach, Less has attracted a very strong and loyal user base.
CSS-Crush ranks way behind Less and Sass in terms of popularity, but that shouldn’t be an excuse for us to underestimate its ability. It comes loaded with everything you might ask for: variables, inheritance, nested rules, and so on!
Perhaps the biggest USP of CSS-Crush is the fact that it makes use of PHP. Now, due to PHP’s popularity, you can run CSS-Crush on virtually any common server, even if it is a simple $2.25 per month shared hosting account. You have no need to fidget with Node.JS and/or other stuff, simply because PHP has become more or less omnipotent when it comes to scripting languages.
Ever wanted to use a future CSS syntax without having to wait for web browsers and/or W3C to follow suit? If yes, Myth is the answer to your problems.
Basically, Myth lets you implement future CSS syntax without having to worry about browser support or specification statuses. Thus, when the given syntax does become available in browsers, you have zero need to rewrite your code.
Myth is based on Node.JS
Stylus is a dynamic and robust CSS preprocessor that comes with its own plethora of custom functions, such as saturation().
Stylus also freely allows you to omit braces, semi-colons or colons, thereby making the code more presentation-friendly and readable.
DtCSS is another useful CSS preprocessor that comes with nested selectors, mixins as well as a smart caching system.
Plus, much like CSS-Crush, DtCSS too is based on PHP, and that means it can also be easily run on most common platforms and servers.
As the name suggests, Rework seeks to help those who, dare I say, wish to reinvent the wheel.
If you are someone who wishes to launch a CSS preprocessor of your own, Rework is probably the tool for you. Maybe, for example, Sass is too mainstream for you, or the syntax of Less and Stylus shouts “rookie” in your dictionary? Alternatively, you do not need a zillion custom functions or the bloated set of features that every preprocessor comes with, and are just looking for a simpler solution that sings to the tune of your own music? In either Rework is what you would use if you wish to write your own preprocessing rules or parsing functions.
Clay is a CSS preprocessor based on Haskell. As such, all its selectors and style rules are first class Haskell functions in their own right — this makes reusability and composability pretty easy!
Clay supports nested style rules, media queries and anything else that you might expect from a CSS preprocessor. Since Clay is based on Haskell, you’re gonna need a Haskell compiler in order to get it up and running.
9. Switch CSS
Switch CSS is a CSS preprocessor that runs under Apache. Therefore, you will need mod_python to be installed and enabled for Switch CSS to run.
Switch CSS comes with a GPL v2 license and has been coded in Python.
Compass is not just a CSS preprocessor. Instead, it pitches itself as a full-fledged CSS Authoring System.
Compass in itself is based on Sass, and is thus able to make use of all Sass features, such as variables, mixins and selector inheritance. It is highly popular and is under active development.
Which CSS Preprocessor Do You Use?
That brings us to the end of this roundup of CSS preprocessors. Which one do you actually use for your projects?