I am trying to use @apply on my custom class in Nuxt.js 2
nuxt.config.js
export default {
buildModules: [
'@nuxtjs/tailwindcss',
],
tailwindcss: {
cssPath: '~/assets/app.css',
exposeConfig: true
}
}
assets/app.css
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer utilities {
.btn {
@apply border-2 p-2 font-bold;
}
}
in any vue-single-file or any other scss file
<style lang="scss">
.btn-lg {
@apply btn;
}
</style>
The
btnclass does not exist. If you're sure thatbtnexists, make sure that any@importstatements are being properly processed before Tailwind CSS sees your CSS, as@applycan only be used for classes in the same CSS tree
So, how to make my custom styles be seen by the Tailwind CSS before processing to make my custom classes work in @apply?
I've tried the solutions in the following questions and document
- adding-custom-utilities
- not able to use custom classes in @apply in scss file tailwind nextjs project?
But none of them work
I am using:
- Tailwindcss 2.2.19 via @nuxtjs/tailwindcss
- Nuxt.js 2.15.8
Thanks a lot for any replies!
