-
Notifications
You must be signed in to change notification settings - Fork 150
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
Global styles not supporting composed selectors like :is() #501
Comments
svelte: 3.55.1 Having the same issue: <style lang="scss" global>
.highlight {
background: yellow;
}
div:has(input.highlight) {
span {
color: red;
}
}
.test {
input {
@extend .highlight;
}
}
</style> Output
A workaround would be to wrap the problematic part in <style lang="scss" global>
@use 'node_modules/.../highlight.scss';
.test {
input {
@extend .highlight;
}
}
</style> |
A potential fix would be to set the
It excludes the content of the parentheses. |
This bit me hard when migrating from Tailwind v2 to v3. The symptom was that dark mode in my app stopped being dark, it was stuck in light mode. They changed how class-based dark mode works, and it took me way too long to realize that the breakage was being caused by svelte-preprocess. Selectors that should look like this: are instead emitted like this: when one brings in tailwind like this: <style global lang="postcss">
@tailwind base;
@tailwind components;
@tailwind utilities;
</style> Quite the bummer. Now I'll have to find some workaround based on patching/forking svelte-preprocess or by doing string replacements on the resulting CSS bundle, and I'm not sure which approach I'm least looking forward to 😅 |
I'm having this exact issue right now. Any temp fixes so far? |
@alvissraghnall I'm sorry I'm some months late but it turns out I wasn't subscribed to this issue and only saw your message when checking if this issue was fixed. The "fix" I've found is to use patch-package to modify
|
Is this a fix someone would want to upstream so we don't have to use patch-package suggested by @gbl08ma? |
+1, this has been left open for longer than it should ! |
Has anyone found a condition where that modified regular expression fails? I am going to submit a PR so hopefully this can get fixed. Right now it's preventing me from using either tailwind (and daisy ui) with my svelte project. |
Ok, I opened a PR as I didn't see any existing PR for this change. |
Thanks for the fix ! 👌 |
Problem
Using the
global
attribute on a style block will prevent any use of composed CSS selectors inside it. Markup as simple as the following will trigger the error.Output
I would expect
:global(article h1) :global(article h2)
to be a more correct preprocessed output.The text was updated successfully, but these errors were encountered: