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

your compiled CSS will balloon hugely -- in fact, you're kind of defeating the whole point

Obviously, it depends on the use-case, but I doubt it would balloon too much. The styles themselves aren't expanding at all — all that would be happening in your example would be that you'd have

    .red, .foo {color:red}
    .big, .foo {font-size: 2em}
    .narrow, .foo {letter-spacing: -1px}
    .foo{border-radius: 10px}
(or whatever). So you'd be adding a bunch of ", .foo"s in the CSS. And, yes, most class names will be longer than that, but I don't know that for most web applications you'd be adding too much bloat. Even an inefficient CSS file is going to add minimal overhead when compared to an additional image file or javascript library.

As to "you're kind of defeating the whole point" ... well ... what is the point? If your point is optimizing to get the absolute fastest download speeds, then it very well might be a bad direction to go in. But in terms of developer efficiency, using @extends and mixins can make the process radically easier. I'm working on an approach to CSS architecture that's similar to the original article linked (lots of @extends), and the benefits have far, far outweighed the costs. I'm still experimenting with it, and it's not ideal for every use-case, but I've been working with CSS for over 10 years, and it's the best approach I've found.

Definitely agree with you on the critique of the 37signals approach. It seems like a very fragile method.



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

Search: