views:

470

answers:

2

The Ruby LESS gem looks awesome - and I am working on a Python/Pylons web project where it would be highly useful. CSS is, as someone we're all familiar with recently wrote about, clunky in some important ways. So I'd like to make it easier on myself.

Is there an existing Python module or library that provides parallel functionality?

+1  A: 

The thing that first comes to mind for me is CleverCSS, a more powerful CSS-ish language with Python and Haskell implementations. I don't know how production-ready this is.

Mike Graham
Hey, that looks promising. Thank you. I hope it's not the only option, though.
Sean M
@Sean, why do you hope that? Is there something about it you did not like?
Mike Graham
If you choose to go the CleverCSS way, I would recommend using [Jared Forsyth's fork](http://github.com/jabapyth/clevercss), which seems to have fixed quite a few bugs, added missing features like includes, and is actively maintained, while the official CleverCSS was last updated in 2007.
Aram Dulyan
+3  A: 

I have need for a Python lesscss compiler too, so have started work on one here: http://code.google.com/p/lesscss-python/

Version 0.0.1 has been released, with no support for namespaces/accessors. It is probably riddled with bugs too.

Please feel free to chip in with bug reports/coding or have a look at less-js http://fadeyev.net/2010/06/19/lessjs-will-obsolete-css/.

Metalshark
Hey, good luck with that, I'm going to keep an eye on it.
Sean M
Looking at the Ruby version it looks like it shouldn't take a whole lot of work to write out the parser/lexer, at least if you're familiar with such things. If I had more use for it, I'd probably try to knock out a CFG. Probably take ~30 minutes to get a rough draft...
Wayne Werner
However I am not familiar with parsers or lexers (book ordered from Amazon on Bison and Flex). There are a few "issues" with lesscss as it stands (like @media, @font-face's src and "salmon + #111"), so have implemented it using regular expressions, recursive lookups and elbow grease; nearing feature parity right now.Found the current implementation unapproachable so am breaking it up for ease of maintenance - downside is that it'll perform terribly in a comparable benchmark.
Metalshark