variants are broken in @apply in Svelte and Tailwind v4 #17993
Unanswered
slingshotsys
asked this question in
Help
Replies: 1 comment
-
Try using <style>
@reference "../../app.css";
.errors {
@variant hover {
@apply bg-red-400;
}
}
</style> Seems to also work in the Svelte Playground, so could be specific to the version(s) of related packages you're using or something specific to your project. As an aside, Adam Wathan (creator of Tailwind) does seem to advocate avoiding |
Beta Was this translation helpful? Give feedback.
0 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
What version of Tailwind CSS are you using?
4.1.6
What build tool (or framework if it abstracts the build tool) are you using?
Svelte 4, Vite 5.4, @tailwindcss/vite 4.1.6
What operating system are you using?
For example: Windows
Describe your issue
I am using @apply inside a Svelte component, referencing my app.css file as per the docs.
This works just fine. However, as soon as you add a variant (or anything with a colon, probably), you get an error:
This seems to be a postcss-related error, since the postcss plugin is part of
@tailwindcss/vite
now. Maybe Vite is throwing the error before tailwind has a chance to run?Beta Was this translation helpful? Give feedback.
All reactions