Should I use BEM?

I mostly use IDs instead of class so I don’t know if BEM is a good idea.

What do you recommend?

I would start by not using IDs, only classes. CSS is difficult to manage. Not using IDs for styling would be a start in making your CSS easier to manage. BEM is a way of managing large CSS codebases (most CSS codebases get large very quickly, so tbh this is most), I would start by making sure you understand basic best practices first.

1 Like

I’m of the opinion that scoped CSS is a better solution than BEM. You should still write your global (non-scoped) CSS with a consistent naming convention, but DX also has to be considered, like having actually meaningful identifiers and convenient utility classes.

BEM predates the widespread use of CSS preprocessors like SCSS and PostCSS that can mangle scoped CSS into unscoped, among other useful things. BEM was a good technique for its time, but like Hungarian Notation, it’s time to put it out to pasture.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.