Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is something I've been thinking a lot about recently, and while all of these approaches solve some problems I think the requirement for maintainable CSS is a fundamentally different approach to the purpose of CSS. Once you make the mental switch from "CSS is the stuff that I do to make the things that I build look right" to "CSS is a component of everything I build" it becomes easier to see what I mean. It's not about "I need to be able to reuse this font size" as much as it is "I want to reuse this widget when I am display text in this way on any page".

In other words, if you want to build something maintainable, start thinking about all the ways you can help people not write custom CSS at all.

Also, LESS and SASS at their core do little to help with this problem, and can even hurt you with unintentional specificity (due to nesting) that hurts reusability. Mixins help you think "reusability" but they can really easily be misused in ways similar to how people are misusing CSS right now. This is by no means an attack on LESS/SASS, which I love. It is just a reaction to working on a large project that is making the switch and seeing the fallout.



I'm not sure I follow. Are you advocating writing "classless" CSS? Could you elaborate as to what you mean by "not write custom CSS"? I don't mean to be pedantic but CSS of any kind is "custom". I think you are advocating OOCSS techniques but trying to call them something else. (No offense)


I am saying that you can follow OOCSS coding practices and still wind up with a ton of really great abstracted styles that you don't reuse. That is because most people look at OOCSS and only see the "this is how you write proper CSS" and don't realize that most of the work is around planning and communicating. How many of the folks using OOCSS have a style guide of some kind that they are sharing to let people know what exactly is available to be reused?

This article focused on the first part and even compares different approaches, but misses the point that OOCSS is advocating a process overhaul, not just a change to the way that you write CSS.

When I say help people not write custom CSS, I am referring to reuse. Writing the code the right way is of course a pre-requisite, but from experience, not nearly enough.




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

Search: