9 ms·
BEM, to me, comes in two parts. There's the CSS naming conventions and then there's implementation. I dislike the implementation of BEM using XML or JSON, I thi
by russelluresti 14y ago
BEM, to me, comes in two parts. There's the CSS naming conventions and then there's implementation. I dislike the implementation of BEM using XML or JSON, I think it's kind of obscure on how everything works. However, I do like BEM for the CSS aspect of it. Basically, BEM is a particular style of OOCSS. All it really offers (from the CSS point-of-view) is a standardized way to name your modules (or "blocks" in BEM).
If you've ever used OOCSS, you can see how naming can become an issue when it comes to code readability. If I have a module called ".nav" with subset items such as ".nav-item" or ".nav-link" it's easy to understand. ".nav" is the parent module, ".nav-item" and ".nav-link" are elements that make up the ".nav" module. But when you start getting into modifiers, naming gets hairy. For example, I can have a vertical nav or a horizontal nav. So how do I name those variants? ".nav.vertical"? ".vertical" by itself just isn't descriptive of what it belongs to. Plus, other modules may also have vertical arrangements. So then ".nav.nav-vertical"? The readability decreases as you use ".nav-vertical" for a modifier but ".nav-item" for a building element.
So, the value of the BEM approach is that it just provides a standardized way to name your modules, elements, and modifiers so that you have code that is easier to comprehend just by looking at it. Now, do I happen to like their specific naming convention? Not really. But it does work for them.
I feel like this project was built with the naming convention aspect of BEM in mind, and isn't really associated with the XML/JSON implementation aspect of it. So, for that, it's kind of nice (though you could really do the same thing with Sass or LESS as long as you were just mindful of following the naming conventions - BOSS just makes it easier because it takes that responsibility off of you).
To me, this project makes a lot of sense and isn't really hard to understand, but that's because I have an understanding of other CSS preprocessors and BEM. If you didn't know about either of those things, I can see how this project would be very confusing and unapproachable.
- catshirt 14y agoyou're right- while unnecessarily verbose... i tried to explain that my concerns lie with BEM itself and not BOSS. that all said, i'd like to substitute my articulation for your own: "Now, do I happen to like their specific naming convention? Not really. But it does work for them."