-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSS Modules / Import Assertions #29
Comments
I tried Import Assertions like this:
But Rollup (with plugin) didn't work very well with just I tried 2 orders:
First one worked on dev build (obviously for Chrome, with some struggle, helped by polyfill in Safari), but for build with rollup if produced invalid Second attempt made the imported object not a I think the right order is the first one (assertions, then litcss), so I gave it a try with with const naivelyUnwrapFromWhatAssertionsPluginProduced = css => {
if (css.includes('CSSStyleSheet')) {
return css
.replace('const sheet = new CSSStyleSheet();sheet.replaceSync(`', '')
.replace('`);export default sheet;', '')
}
return css;
} Aaaaand... that worked. |
yes @jrencz that tracks, so I'd like to implement the plan from OP now and make a boolean config option like Once tooling and browser support matures, I'd switch the default to |
Users should be able to opt-in to polyfilling css modules / import assertions, rather than getting the css-tagged-literal version
A later breaking version would switch it to opt-out (i.e., users would then have to opt-in to what is now current behaviour)
The text was updated successfully, but these errors were encountered: