-
-
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
feat: native constructible stylesheets #30
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: d85ee52 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
cc @jrencz wdyt of this? I'm not 100% convinced how good this works with import assertions. does this even make sense? does this make any sense at all? import style from './style.css' assert { type: 'css' };
export const sheet = new CSSStyleSheet();
sheet.replaceSync(`html {
display: block;
}
`);
export default sheet; |
Instead of having js in a
html {
display: block;
}
import style from './style.css' assert { type: 'css' };
export const sheet = new CSSStyleSheet();
sheet.replaceSync(style);
export default sheet; |
that adds an extra import though |
I was thinking that this block would be injected below the import statement:
But I suppose that's probably not what you want. 🤔 |
you're right I'm not super jazzed by it 😉 So I guess the question this PR is asking is "do we want to export native css style sheets in the manner of css modules, but import them without import assertions in the manner of css-in-js"? |
I like Potter's suggestion here for syntax. JS in a CSS file will be a blocker for a lot of folks adopting something like this. Part of the original goal in allowing traditional CSS files and importing them into the web components was to allow front-end developers not experienced with JS to contribute & engage in the projects. |
ok so maybe this PR is a bit too broad in scope I think it should just be about exporting native constructible stylesheets, and questions about import assertions can be removed from the docs. then, as now, users could still choose to write .css.js, but docs will still recommend .css would that make sense @heyMP @castastrophe |
Closes #29