Skip to content

[bug?/v4] Cannot use @apply in css module in Vue SFC #17583

Closed Answered by wongjn
kakkokari-gtyih asked this question in Help
Discussion options

You must be logged in to vote

Seems like the build system doesn't use Vite plugins on CSS modules. This means the Tailwind CSS syntax doesn't get processed:

Furthermore, as per the documentation:

[…] we don't recommend using CSS modules and Tailwind together if you can avoid it.

Also, Adam Wathan (creator of Tailwind) does seem to advocate avoiding @apply:

Instead, consider writing all class names inline:

 <template>
-  <h2 class="text-2xl font-bold" :class="$style.moduleApplyClass">The color of this text should be blue (--color-custom)</h2>
+  <h2…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@wongjn
Comment options

wongjn Apr 21, 2025
Collaborator

Answer selected by kakkokari-gtyih
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants