|
|
|
|
|
by rtsao
3481 days ago
|
|
I think the argument is that separation of UI components is a more true "separation of concerns" than separating CSS, JS, and HTML. The implementation of a UI widget is ultimately a combination of CSS, HTML, and JS which are coupled to some degree, so by colocating them together, the component is easier to manage. But to do this effectively, you need some way to get around the global nature of CSS. CSS modules and CSS-in-JS are means of achieving this. A good blog post about this topic is: https://medium.com/seek-developers/the-end-of-global-css-90d... |
|
But you can still keep CSS in a CSS file inside a module folder. SASS or any other CSS build took could grab it from there.
> get around the global nature of CSS
That can be done with proper scoping supported naturally by CSS.
Local CSS is still not as bad as moving CSS declarations to JavaScript.