The Dopefly Tech Blog

<< The Dopefly Tech Blog Main page

Less CSS - how CSS should have been!

posted under category: Standards on July 24, 2009 at 11:00 pm by MrNate

Has anyone else seen Less - Leaner CSS? Let me sum it up for you. It goes like this:

WHAT IS WRONG WITH THE W3C?

And you can take that one to the bank.


Seriously though, Less is an app built in Ruby that lets you write CSS in a reasonable fashion, which it will compile into unreasonable standard CSS.

And what is reasonable for CSS? Where is it that the W3C has failed us so terribly? Less' feature set says it all: variables, mixins, nested rules and operations. You'll probably have to see it to believe it, but once you see it, you'll get it. Go ahead, visit the Less CSS site, just the home page shows you everything.

My only problem with it is that it's Ruby. I don't have anything in particular against Ruby, I just don't want to install it or figure out how to use it to start coding with Less.

So where does that leave me?

1) Rewrite it in a language I like more
2) Suck it up, use Ruby
3) Recompile it with jRuby
4) Run it with HotRuby (translate into Javascript)

Until then, I guess I will just be dreaming about it.

Post A Comment!
On Jul 26, 2009 at 11:00 PM Matt Williams (http://www.mattjanell.com/blog) said:
Why not just make your css file a cfm file and do something like so?

<cfset brand_color = "#4D926F">
<cfoutput>
##header {
color: #brand_color#
}

h2 {
color: #brand_color#
}
</cfoutput>

On Feb 19, 2010 at 9:00 PM Roland Collins (rcollins at the ever-endearing investedge.com) said:
@Matt - one word: caching.

If you put your CSS in a cfm file, you also need to ensure that said file properly communicates caching directives to the browser.

On the easy end of the solution spectrum, this might just mean adding a few cfheaders to your cfm/css page to communicate "not modified" directives. If your css is truly dynamic, well then you've just eliminated one of the biggest benefits of css, which is that it gets cached by the browser.


On Feb 19, 2010 at 9:00 PM Barney Boisvert (bboisvert who dances with gmail.com) said:
All your problems have already been solved: http://www.barneyb.com/barneyblog/2009/09/08/lesscss-for-cfml-developers/

Well, maybe not all of them, but you can at least run it automatically from you CFML app.
Post A Comment!