Tailwind v4 bg-* classes not working in nextjs with shadcn #19150
-
|
The below is my global.css @custom-variant dark (&:is(.dark *)); @theme inline { @layer base { :root { .dark { html, html::-webkit-scrollbar, Component.json postcss.config.mjs export default config;
Both justify-end and bg-green-300 is not working Whats strange is that this exact setup is working in another one of my repos Kindly help |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
|
Consider providing a git repo that reproduces the issue and we can take a look for you. |
Beta Was this translation helpful? Give feedback.
-
|
https://play.tailwindcss.com/j8fT0QVHFi?file=css If I had to guess, you have some extra CSS that you haven't shared with us. It's important to note that TailwindCSS uses CSS layers, which will always be weaker than any unlayered styles. Therefore, it's a good idea to force all your CSS into layers and establish a consistent order.
Wrong example with too strong unlayered CSS: |
Beta Was this translation helpful? Give feedback.
-
|
Okay, I debugged it further and figured out the Root cause but dont have a fix yet const inter = Inter({ export const metadata = { export default function RootLayout({ The above is my main 'layout.tsx` and I am using a custom inter font, when I remove the variable or the weight then the bg classes starts working |
Beta Was this translation helpful? Give feedback.
-
|
I figured out the issue. For dev I was using the default run dev command which in turned called |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for your time and help @wongjn @rozsazoltan . If any of you have a idea as to why this happened do let me know. So I can understand the issue |
Beta Was this translation helpful? Give feedback.



I figured out the issue. For dev I was using the default run dev command which in turned called
next dev --turbopackremove turbopack from the command resolved the issue