-
-
Notifications
You must be signed in to change notification settings - Fork 113
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!: preprocess style tags by default #756
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is fine too! Repeating what I said in the linked issue: svelte-preprocess
will preprocess style blocks without lang
if the postcss
configuration is found/valid..
My main question is whether language-tools would know to run the preprocessor, so I'd want Simon's approval |
@dummdidumm objections? My concern is that without a lang= tag, the content of style blocks might not be treated correctly in the ide, eg for the lightningcss case it would choke on nesting or the custom media rule ( #733 ), leading to false positives/squigglies |
@dummdidumm is on vacation, so you might have to ask again later 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with this. The fact that the IDE may give false positives shouldn't hold up this valuable PR - and people can tune their config / add a lang tag if needed. We may also be able to detect some of this inside language tools and don't show CSS errors. And since nested CSS is now part of the spec, the upstream vs code html language service might even support it at some point.
If people report performance regressions from postcss going all over their files without lang=postcss tag, we can add an option to restore the previous behavior or recommend they switch to lightningcss? |
fix #733
Follow Vite's behavior to preprocess all CSS by default with postcss or lightningcss.
Note: there's a small optimization in Vite where it skips postcss if there's no
@import
and postcss plugins. Lightningcss doesn't seem to have that optimization.This affects preprocessing in component libraries too, but I think they should only have a small impact.