DEV Community

Discussion on: How To Stop Writing Messy & Unscalable CSS

Collapse
 
layzee profile image
Lars Gyrup Brink Nielsen

What do you think about CSS Modules and shadow styles for web components?

Collapse
 
bytomray profile image
Tom Ray

Hey Lars! I haven't got much experience in either, so I can't comment. That being said, I'm super interested in the whole CSS in JS space with CSS Modules/Styled components and other solutions as a way to manage CSS with JS frontend frameworks. If you have any resources worth reading, please share!

Collapse
 
layzee profile image
Lars Gyrup Brink Nielsen

I only tried CSS Modules based on this small React sample: create-react-app.dev/docs/adding-a....

Angular can use either shadow DOM or use what they call emulated view encapsulation which similar to CSS modules assigns unique selectors to each class used in a component. However, the component uses a regular stylesheet and applies regular classes to the HTML elements, the framework does the wiring up.

Thread Thread
 
bytomray profile image
Tom Ray

Interesting. Thanks Lars. Iā€™m going to give CSS modules a shot šŸ‘

Thread Thread
 
layzee profile image
Lars Gyrup Brink Nielsen

I absolutely love them when combined with React.