3 ms·
Well yeah if you want to avoid a flash of unstyled content then you have to wait for the browser to style the content. The main problem is the style duplication
by throwitaway1123 3y ago
Well yeah if you want to avoid a flash of unstyled content then you have to wait for the browser to style the content. The main problem is the style duplication issue which someone else pointed out elsewhere in this thread.
- niutech 3y agoUnless you link the same cached CSS file in every web component.
- throwitaway1123 3y agoThat adds an additional network request.
- niutech 3y agoNo, the CSS is being requested only once and cached in the browser, subsequent requests are being served from browser cache.
- throwitaway1123 3y agoThe browser cache doesn't help on the first visit when the cache is empty, and the cache will also have to be invalidated whenever the component's CSS changes. And if the CSS file isn't cached then you also have to contend with the flash of unstyled content problem while the browser loads the CSS file. The Lit docs do a good job of explaining this: https://lit.dev/docs/components/styles/#external-stylesheet https://lit.dev/docs/components/styles/#external-stylesheet