Tailwind CSS is not applying to the app folder in the next.js v13, but it is working on the Pages and Components folder. In the tailwind.config file, I have added
However, no CSS is being applied to components in app folder!
content: [
"./pages/**/*.{js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx}",
"./app/**/*.{js,ts,jsx,tsx}",
],
try to check the following: (works for me)
set
experimental.appDir: true
to enable app directory feature
const nextConfig = {
experimental: {
appDir: true,
},
}
module.exports = {
content: [
"./app/**/*.{js,ts,jsx,tsx}",
"./pages/**/*.{js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx}",
],
...
}
@tailwind base;
@tailwind components;
@tailwind utilities;
import css in layout => works fine
import css in page => not working
import './globals.css';
...
Had the same problem.
I moved globals.css from /app
to /styles
, and then import in app/layout.tsx
.
Now works fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With