4 ms·
In another comment[0] I also mentioned using Shadow DOM for modularizing CSS. However I got a comment "Shadow DOM is not the solution for CSS isolation for comp
by octref 11y ago
In another comment[0] I also mentioned using Shadow DOM for modularizing CSS. However I got a comment "Shadow DOM is not the solution for CSS isolation for components." and the commenter referred me to css-modules.
I'm wondering what's the merit/advantages of using css-modules over using Shadow DOM to limit the scope of CSS rules.
[0]: https://news.ycombinator.com/item?id=10453076 https://news.ycombinator.com/item?id=10453076
- Zikes 11y agoShadow DOM enforces CSS isolation incidentally, but is also part of the larger "web components" plan, which would also incorporate CSS modules. In these cases you would fully encapsulate CSS, HTML, and JS on a per-component basis.