4 ms·
Web Components use of the shadow DOM is designed for this very use case. I never have to worry about clashes or getting too cute with my naming conventions. Yo
by mhoad 4y ago
Web Components use of the shadow DOM is designed for this very use case.
I never have to worry about clashes or getting too cute with my naming conventions. You can just use a h1 selector and not think about it.
- pcthrowaway 4y agoVery interested in learning more about this. Do you know if there are any open source projects I can take a look at?
- quechimba 4y agohttps://shoelace.style/ https://shoelace.style/ And here's an experiment I'm working on, where all styles are scoped to components because all static DOM trees become custom elements with their own shadow root: https://github.com/aalin/rdom https://github.com/aalin/rdom
- mhoad 4y agoThis is in some places a little bit specific to Lit but mostly not and walks you through that shift in mental models from start to finish that tends to trip people up a lot coming to Web Components https://youtu.be/Xt7blcyuw5s https://youtu.be/Xt7blcyuw5s FWIW if you are interested in Web Components I would say Lit is hands down the best entry point I’ve come across. Strong recommendation and nullifies most of the common complaints you tend to hear associated with them.