DEV Community

Discussion on: How I Moved a Step Closer to Clean CSS and How You Can Too (with the BEM Methodology)

Collapse
 
squidbe profile image
squidbe • Edited

Yup. CSS modules basically do what shadow DOM does without the need for heavy polyfills or clunky syntax. What I love about Vue is that you get this behavior for free. Just add the "scoped" attribute to your component's style block, and Vue takes care of the hash for you. After 2 years of BEM and utility CSS (I was forced to use both at the same time), I'm loving Vue's built-in CSS module behavior.

But whichever way you do CSS modules, they're great because you don't have to worry about the rigidity and verbosity of BEM or the "unsemanticness" of utility CSS (I much prefer a class name like "date-widget" to a string of class names like "p-4px align-left color-red-8 [more class names that describe style instead of function]".

Collapse
 
cedricgourville profile image
Cédric Gourville

We agree on this point.
And your html too, is more readable, in my opinion