views:

366

answers:

3

When I say CSS Framework, I don't mean a reset or a grid. I mean a framework like xCSS or csscaffold or compass.

I've been doing CSS for a couple of years, but has not had a lot of exposure to frameworks. Does anyone have any experiences working with them? What are some potential downsides? What frameworks are popular/recommended?

Thanks.

+7  A: 

The coolest CSS framework I know about is LESS. It allows you to add variables, inheritance, arithmetic operations, and other coolness using CSS-like syntax-- and it "compiles" down to regular CSS using a build step or server plugin.

Like C to C++, LESS's syntax is backwards-compatible to CSS, so you can simply rename all your .CSS files to .LESS and start adding LESS functionality without learning a whole new language.

As the comments note below, Rails and PHP support LESS already via server plugins. There's also an ASP.NET port in Beta. There's also apparently Django support. And Cold Fusion. And so on...

Note that using LESS (as a Ruby executable which spits out CSS files) can be as simple as running it to compile .LESS files into .CSS as part of your build process. The build machine has to be able to run Ruby of course, unless you're using one of the plugins which ported the LESS compiler to that platform's natural code.

Note that xCSS offers similar features to LESS-- I'd not heard about xCSS though. AFAIK LESS is more popular, but others in the community here can weigh in since popularity changes fast!

Justin Grant
Is LESS Ruby specific?
Alix Axel
LESS has been ported to PHP: http://leafo.net/lessphp/docs/ It's **not** a CSS framework, however - at least not in the same sense as "Blueprint" or "960".
ChssPly76
Yep, it seems like there are apparently two meanings of "CSS Framework": those like Blueprint which are focused on grids/resets/etc. and others (LESS, xCSS, etc.) which are more minimalistic with features like nesting, inheritance, etc. without the higher-level stuff. It's a reasonable argument whether the second group should be called "frameworks". They do however call themselves frameworks (at least xCSS does at http://xcss.antpaw.org/) and the OP is asking things like xCSS, so I followed his use of the term. :-)
Justin Grant
Thanks for the link to LESS. What would be a better term for it? As in, other than css framework.
Jourkey
LESS is really nice indeed. The cool thing is that it uses the same basic syntax as CSS, so you don't have to learn a lot of new stuff, (You could probably see that as a bad thing too,) and you don't need to rewrite all your files.
Douwe Maan
CSS isn't hard enough to justify using something like LESS.
jfar
Good points @DouweM-- I forgot to put that advantage in my original answer. Fixed now.
Justin Grant
@jfar - it's not that CSS is hard, it's that maintaining lots of CSS across a large project (especially in a multi-tenant environemnt where you're managing 100's of similar-but-slightly-different CSS files) is expensive and error-prone. Tools like LESS are one was to reduce the cost. Some devs like the LESS approach, others prefer to use separate CSS files and overrides, others just dynamically generate and inherit CSS using custom server code. IMHO, any of these approaches can work OK.
Justin Grant
I'd say Less is a CSS extension library. By the way, using mixins you can really work well with those frameworks (grouping framework stuff etc.)
Erik van Brakel
A: 

CSS isn't hard enough to justify a using a framework.

jfar
That's only true if there is a downside to using a framework. In a large project features like variables and selector inheritance can save a lot of development time, especially considering down the line maintenance and editing. That's just imo anyway.
Jourkey
There is a huge downside to using a framework as its just one more thing that somebody has to learn. Further maintenance is even more disrupted if the person who didn't write the original css has to also learn a framework.Selector inheritance? thats just a feature that mimics what css does already.
jfar
Yes, but frameworks can make the inheritance seem more organized to the developer. Look at this page: http://xcss.antpaw.org/docs/syntax/extends . It's a pleasing superset of functionality. I don't think learning a framework is much work, there's really very very little to it. However your point is well taken though.
Jourkey
You'd really need to asses the requirements of an individual application before you made a statement like this. Evaluate the best solution on a case by case basis. A framework could be an excellent method for enforcing designs rule for example.
Rimian
+1  A: 

CSS hasn't really changed much since it was first supported in the Nineties. It's outdated and doesn't follow best practices that have evolved since its conception. I believe the emerging frameworks like xCSS are a result of these shortfalls of CSS.

With this in mind, it's puzzling that CSS frameworks receive a fair amount of criticism. A framework is a tool! You can't really assert than there isn't a valid use case for it. How would a developer know such a thing?

I've been using xCSS to apply the concept of Object Orientated CSS. It's early days but it's looking like it's a very useful tool. It's helping me present an interface to CSS to third parties that have no need to learn CSS. It's helping me reduce duplication of information and it groups CSS attributes and classes into a format that can protect against the software rot of distributed information.

Rimian