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.