- From: Jason Miller <notifications@github.com>
- Date: Wed, 30 Jan 2019 16:28:42 -0800
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 31 January 2019 00:29:04 UTC
Could polyfill via ServiceWorker too, or [import maps](https://github.com/WICG/import-maps) (though awkward). I'm mostly here to drop a firm +1 on the issue. I threw a [proposal](https://gist.github.com/developit/689aa4415bd688f3fce923cb8ae9abe7) together that turned out to be exactly what Justin is pushing for here, just using the current version of [Constructable Stylesheets](https://github.com/WICG/construct-stylesheets). ```js import sheet from './style.css'; // global CSS: document.adoptedStyleSheets = [sheet]; const node = document.createElement('div'); const shadow = node.attachShadow({ mode: 'open' }); // scoped CSS: shadow.adoptedStyleSheets = [sheet]; // Updates! (propagates out to all affected trees) sheet.insertRule('.foo { color: red; }'); // "hot CSS replacement": (to be taken with healthy dose of salt) module.hot.accept('style.css', req => { sheet.replace(req('style.css')); }); ``` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/webcomponents/issues/759#issuecomment-459166374
Received on Thursday, 31 January 2019 00:29:04 UTC