3 ms·
"Nesting in Sass should be avoided" concurrently with "By doing this, a developer can see at a glance that .foo__baz {} lives inside .foo__bar {} lives inside
by al2o3cr 12y ago
"Nesting in Sass should be avoided"
concurrently with
"By doing this, a developer can see at a glance that .foo__baz {} lives inside .foo__bar {} lives inside .foo {}."
It's like reinventing descendant selectors, but with more typing. In fact, if descendant selectors weren't supported by browsers, this would be the workaround.
And for the punchline, the authors suggest that "descendant" selectors (.foo__bar, etc) in plain CSS files should be indented additional spaces. Y'know, so they like the nesting in Sass that you're not supposed to do. (facepalm)
OOCSS seems to combine all the ridiculous trends in computing into one bundle of sad: OO-fetishization, "don't do that because it takes a microsecond longer sometimes" premature optimization, and "hypothetical reusability trumps actual usability"...
- tobr 12y agoI supposed the idea is to limit specificity. It's the same reason you should use class instead of id. I find the BEM syntax to look horrible though, with the double hyphens and underscores. Why not e.g. capitalize blocks and elements, keep modifiers lower case, and just use single hyphens?