Does BEM Still Make Sense When AI Writes CSS?
I use BEM. Sometimes.
Most of my CSS is plain CSS, with a main stylesheet and a few additional files for specific areas, such as blog.css . The HTML is rendered on the server using Marten . During deployment, a minifier takes care of the CSS, and Marten's collectassets handles fingerprinting.
That's pretty much my entire CSS toolchain. And I like it. There's very little overhead, and it does everything I currently need.
But with AI coding agents writing more of my code, I started wondering whether my approach still made sense. Should I use BEM more consistently? Switch to data attributes for modifiers? Or consider something like Tailwind or CSS Modules?
I ended up asking a Codex agent whether replacing BEM modifiers with data-* attributes would improve an existing project.
Its answer was rather simple:
data-* doesn't automatically make sense as a replacement for BEM modifiers.
Well, that wasn't quite the answer I expected.
But it got me thinking.…