Hacker News new | comments | show | ask | jobs | submit login
Python's CleverCSS (pocoo.org)
38 points by iamelgringo on May 25, 2009 | hide | past | web | favorite | 10 comments

I like clevercss a lot, but there are some annoying bugs in the official release. I have a patched version here: http://github.com/dziegler/clevercss/tree/master

Also, check out http://code.google.com/p/django-css/ for easy integration with Django.

"Inspired by Python" or inspired by Sass? http://haml.hamptoncatlin.com/docs/rdoc/classes/Sass.html

margin-right: 5px (CleverCSS) vs. :margin-right 5px (Sass)

But it is nice to see a Python implementation of such an excellent tool.

You can also write margin-right: 5px in SASS. CleverCSS is really very similar, not only its syntax.

But that’s a good thing, seeing other solutions emerge which get rid of those bloated CSS files.

i think SASS is a little more featureful. i was looking at this recently and found no way to include other (clever)css files within a clevercss file, but sass has a way.

something i didn't find in either language is a way to embed literal css (useful for writing ugly hacks that sometimes rely on css parser errors in the browser)

Sounds nice. I especially welcome the variable mechanism for colours so that I don't have to write the hex value of today's favourite color (or its highlighted or shaded variant) everywhere I use it.

I'm not sure yet if I'm happy with the lazily evaluated variables, though. In makefiles, I tend to prefer := assignment (eager evaluation) to = assignment (lazy evaluation) when possible to avoid surprises.

I love Python and CSS as much as the next person, but I always thought Sass was an overengineered solution to a problem that doesn't really exist. Expert CSS coders will always get better results.

It doesn't seem like it's about getting a better result. As far as I can see it's allowing people to get a result in less time.

Imagine if CSS made you style every element individually, so you had to specify the full path through the DOM before applying each style. It's still the same language because you could get the same results - it's just a lot more typing.

It seems to be a similar thing happening with CSS frameworks, although there's less inefficiency to remove than with my exaggerated example.

Adding variables and arithmetic to the mix also has the potential to make things more maintainable if used correctly - if you're setting the same number multiple times or setting a number as the result of a calculation an expert CSS coder will have to remember to update everything (and/or) redo the calcuations every time they want to make a change.

It's a medium sized win but I'm willing to take a look.

So, Sass + object-orientation?

And no @import sass awesomeness.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact