Svelte: Constructable Stylesheets

Created on 22 May 2019  Â·  1Comment  Â·  Source: sveltejs/svelte

Just a question about the roadmap. Are there plans to support constructable stylesheets with Shadow DOM? When using native Custom Elements the styles are repeated for multiple instances of the same element, and constructable stylesheets are a nice solution.

Most helpful comment

Yes, I think so, once they're supported by all browsers. Though until CSS Modules are also supported, I'm not sure they have that much benefit — you still have to transport styles in JavaScript strings (unless you fetch them, leading to FOUC) and <style> tags in shadow DOM are already deduplicated, so the performance benefit is probably fairly modest.

>All comments

Yes, I think so, once they're supported by all browsers. Though until CSS Modules are also supported, I'm not sure they have that much benefit — you still have to transport styles in JavaScript strings (unless you fetch them, leading to FOUC) and <style> tags in shadow DOM are already deduplicated, so the performance benefit is probably fairly modest.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thoughtspile picture thoughtspile  Â·  3Comments

st-schneider picture st-schneider  Â·  3Comments

AntoninBeaufort picture AntoninBeaufort  Â·  3Comments

Rich-Harris picture Rich-Harris  Â·  3Comments

lnryan picture lnryan  Â·  3Comments