This is my vite-react project where I am using tailwindcss and I am getting this error saying
I have already installed tailwind css and bg-dark-1
is a custom class and is already inside @layer directive but not sure why I am getting error.
If I remove
body { @apply bg-dark-1 text-white min-h-screen font-inter; }
the project is working fine.
Can you tell me how to fix the issue?
2
Answers
@apply
is a Tailwind directive and classes you use within it must be recognized by TW. The error is complaining aboutfont-inter
; TW doesn’t know what it is. You should include this in an@layer
directive.Alternatively, if you’re using Sass, you could take
font-inter
out of@apply
and instead use@extend .yourclass
to append the class, or if not this, then simply apply the class directly to the element.apply it as you would in a css file