-
-
Notifications
You must be signed in to change notification settings - Fork 788
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
Svelte Scoped doesn't work with CLSX #3631
Comments
Do you get the same result in recent (not 5) Svelte? |
I do, i updated to svelte 4.2.12 and it's still there |
I've only ever seen I'm closing this as we do not need to nor want to encourage use of <div
class:one-set={flag}
class:the-other-set={!flag} />
<style>
.one-set {
--at-apply: bg-red-100 underline font-semibold and twenty more classes...;
}
.the-other-set {
--at-apply: bg-blue-100 text-xs opacity-50;
}
</style> |
@jacob-8 i laughed, i do indeed come from the React world. The more you know :) Maybe losing a line in the docs would help someone in the future? Thank you. |
@ZeroPie thanks for the good-natured response to my thoughts. Yes, I'll add a note to the docs as you're not the first one thinking to use React is a mysterious and wonderful beast. I feel like they gave everyone a gift in pushing forward a way of doing web development based around components. But at the same time, I feel they also introduced a lot of conventions that were necessary at the time but now are no longer necessary (and a little awkward, like writing style classes using using camelCase) as Vue, Svelte, and a bunch of others have smoothed off a lot of rough edges. Everyone is now innovating and copying each others' best work in step. It's pretty neat to see. |
Svelte is still missing a good way to have multiple classes for a certain condition though, I would personally like something like `classes:"utilities separated by spaces here"={condition}. Hopefully something like this can be added sometime in Svelte 5. |
You could try creating an RFC proposal for such if you want. It may get traction. For others following @henrikvilhelmberglund pointed out in a prior issue that the svelte-multicssclass Vite plugin can help with this in lieu of it being provided by the framework: #2322 |
@henrikvilhelmberglund @jacob-8 How do you guys deal with it? |
UnoCSS version
0.58.6
Describe the bug
using clsx breaks the classes
Reproduction
https://stackblitz.com/edit/unocss-unocss-nfuydr?file=src%2Froutes%2F%2Bpage.svelte
System Info
No response
Validations
The text was updated successfully, but these errors were encountered: