4 ms·
In my admittedly little experience with shadow DOM, it doesn't isolate as much as it claims. CSS variables pierce the boundary, so if your styles are built arou
by 8n4vidtmkvmk 2y ago
In my admittedly little experience with shadow DOM, it doesn't isolate as much as it claims. CSS variables pierce the boundary, so if your styles are built around that, you can still run into trouble.
I just haven't seen any benefit whatsoever once you have CSS modules. And CSS layers help too.
- peebeebee 2y agoShadowDOM, and by extension web components are great for providing an extended set of HTML ‘native’ components. Let’s say your company has multiple frontend SPAs with different technologies (angular, react, svelte,…) they could all use the same set of company custom components, like a custom datepicker, or fancy selectbox.
- epolanski 2y agoThis is the promise, but my experience tells me that web components fall short of that goal.
- epolanski 2y agoThis has been a major concern for me. We went for a web component because we needed the same functionality on different websites using different tools. Issue was that we authored the web component with tailwind and then deployed the web component on different websites, some having different versions of tailwind themselves. Even minor differences in hosts tailwind versions led to quite surprising results. What we did in the end is to write a tool that given the tailwind classes used in the webcomponent it would then rewrite the rules at the :root of the web component's own css. Another reason for unhappiness came from lack of isolation regarding the units that derive from the host's base font which forced us to work in pixels directly. All in all, while I understand some of the decisions that went into web components, I can't lie and say that I too have few reasons to not be fully on the web components train, they fall short of the promise of author once, use everywhere.