BEMantic: DRY Like You Mean It
Matt Stow
18415

Hi Matt, thank you for posting this article! I’m currently bouncing between using BEM/similar and not using it, I can see the advantages and disadvantages from both ‘sides’.

Honest question, as I’m not entirely convinced one should use classes for the sake of using classes. I’ve recently come across some HTML involving a list, where every list item had a class on it (typical BEM notation, something like `some-module__variant`). To me this seems good for a rather short list (say 3 to 5 items) or a list with several variations between items. This particular example however had over 100 items with the exact same class.

Would that be considered good BEM-practise?

I am aware that gzip will take care of most of the added filesize (which is often expressed as a concern) and that class-selectors have performance benefits over element-selectors (in this particular case, there were no other list items on the page, so this benefit was ruled out). Since you asked, I also happen know the specificity of any selector by heart, so I know a single class will override any amount of elements in a selector, which is exactly why it is hard to watch developers apply classes in (for me) edge cases like this.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.