Skip to content

@apply Is it abandoned in v4 #17714

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

Closed
muchenkezhan opened this issue Apr 18, 2025 · 2 comments
Closed

@apply Is it abandoned in v4 #17714

muchenkezhan opened this issue Apr 18, 2025 · 2 comments

Comments

@muchenkezhan
Copy link

<template>
  <div class="f-header">

  </div>
</template>

<script setup>

</script>

<style lang="scss" scoped>
.f-header {
  @apply flex shadow-sm items-center bg-white pl-3 pr-3;
  height: 60px;
}
</style>

Error message:

19:34:07 [vite] hmr update /src/views/markdown/components/header.vue?vue&type=style&index=0&scoped=23126ab5&lang.scss
19:34:07 [vite] Internal server error: [postcss] [postcss] Cannot apply unknown utility class: shadow-sm
  Plugin: vite:css
  File: F:/my-vue/bird_markdown_vue/bird_mardown/src/views/markdown/components/header.vue?vue&type=style&index=0&scoped=23126ab5&lang.scss:undefined:NaN
      at onInvalidCandidate (F:\my-vue\bird_markdown_vue\bird_mardown\node_modules\tailwindcss\dist\lib.js:20:348)
      at me (F:\my-vue\bird_markdown_vue\bird_mardown\node_modules\tailwindcss\dist\lib.js:15:29596)
      at De (F:\my-vue\bird_markdown_vue\bird_mardown\node_modules\tailwindcss\dist\lib.js:20:311)
      at si (F:\my-vue\bird_markdown_vue\bird_mardown\node_modules\tailwindcss\dist\lib.js:36:784)
      at async ui (F:\my-vue\bird_markdown_vue\bird_mardown\node_modules\tailwindcss\dist\lib.js:36:1079)
      at async Cr (F:\my-vue\bird_markdown_vue\bird_mardown\node_modules\@tailwindcss\node\dist\index.js:12:3305)
      at async $ (F:\my-vue\bird_markdown_vue\bird_mardown\node_modules\@tailwindcss\postcss\dist\index.js:10:3320)
      at async Object.Once (F:\my-vue\bird_markdown_vue\bird_mardown\node_modules\@tailwindcss\postcss\dist\index.js:10:3596)
      at async LazyResult.runAsync (F:\my-vue\bird_markdown_vue\bird_mardown\node_modules\postcss\lib\lazy-result.js:293:11)
      at async compileCSS (file:///F:/my-vue/bird_markdown_vue/bird_mardown/node_modules/vite/dist/node/chunks/dep-DkOS1hkm.js:32271:25)

vite +vue3

@wongjn
Copy link
Collaborator

wongjn commented Apr 18, 2025

You probably need to use the @reference directive.


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

@adamwathan
Copy link
Member

Here's the relevant docs:

https://tailwindcss.com/docs/compatibility#vue-svelte-and-astro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants