Next.js Discord

Discord Forum

Need help with integrating tailwind css

Unanswered
Pungsan Dog posted this in #help-forum
Open in Discord
Pungsan DogOP
Hi everyone 👋,

I’m working on an Expense Tracker project using Next.js 15, Tailwind CSS v4, and ShadCN UI.
After upgrading to Tailwind v4, I’m getting errors in my globals.css file on these lines:

@custom-variant dark (&:is(.dark *));
@theme inline { ... }


They are underlined in my editor.

My current postcss.config.js is:

module.exports = {
plugins: {
'@tailwindcss/postcss': {},
autoprefixer: {},
},
};


And my tailwind.config.js is:

/ @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./app/
/.{js,ts,jsx,tsx}",
"./pages/**/
.{js,ts,jsx,tsx}",
"./components/*/.{js,ts,jsx,tsx}"
],
theme: {
extend: {},
},
plugins: [],
};


Does anyone know how to fix this so that @custom-variant and @theme inline work correctly with Tailwind v4 + Turbopack?

40 Replies

@joulev does the app still work fine when you run it?
Pungsan DogOP
Yeah app works fine but css that i am applying is not working
@Pungsan Dog Yeah app works fine but css that i am applying is not working
So does the css work in the app or not? Is the red squiggle line in your editor the only issue?
@joulev So does the css work in the app or not? Is the red squiggle line in your editor the only issue?
Pungsan DogOP
No, CSS is not working in the app. The app runs without throwing errors, but when I apply Tailwind classes, the styles don’t take effect (no visible changes).
@joulev Can you show me a minimal reproduction repository?
Pungsan DogOP
My project repo is still quite small. Do you want me to share my complete project repo?
@Pungsan Dog My project repo is still quite small. Do you want me to share my complete project repo?
If you are fine with it being publicly accessible, sure
Chinese Alligator
in nextjs15 and tw4 there is no need for a tailwind config. Its automatically done by postcss. Also you have a typo in that file (missing and * ). After changing or having problems with libraries i try removing .next folder and node_modules and do a new install.
@Pungsan Dog https://github.com/Alifiyabohra/expense-tracker-debug
You don’t have a postcss.config.js file. You need that file to run tailwind.

Go to the tailwind documentation and follow their installation steps, it will create the necessary files for you
Pungsan DogOP
@joulev I did installed tailwind again, and now there is only postcss.config.mjs file

but when i am adding css in gobal.css using @apply then its not working as it should.
@Pungsan Dog <@484037068239142956> I did installed tailwind again, and now there is only postcss.config.mjs file but when i am adding css in gobal.css using @apply then its not working as it should.
https://github.com/Alifiyabohra/expense-tracker-debug/blob/34586e019baa530b28be2d05a6c7efd384b5394c/app/globals.css#L124

you have a typo here. gradient is not a valid tailwind class name. everything that comes after @apply must be a valid tailwind class name
when you fix that, it should work well
works for me
the only change
if it doesn't work for you, can try deleting .next and restart the dev server again
if still doesn't work, delete both .next and node_modules and reinstall deps
Pungsan DogOP
@joulev Can you please tell me all the changes you made, as i tried this again even reinstalled .next and node_modules but it’s not working. It will be a great help as i am stuck here
@Pungsan Dog <@484037068239142956> Can you please tell me all the changes you made, as i tried this again even reinstalled .next and node_modules but it’s not working. It will be a great help as i am stuck here
1. what do you see instead when you screenshot the current app?
2. if you create a fresh new project with tailwind css, do tailwind classes work there? if yes, can just gradually move things from the current app over
@joulev 1. what do you see instead when you screenshot the current app? 2. if you create a fresh new project with tailwind css, do tailwind classes work there? if yes, can just gradually move things from the current app over
Pungsan DogOP
Thats how it looks
@Pungsan Dog Thats how it looks
as in how does it look for you currently?
Pungsan DogOP
@Pungsan Dog Click to see attachment
Pungsan DogOP
@joulev that how it looks currently
@Pungsan Dog Click to see attachment
yeah... i would try step 2 above. i actually faced this same issue at first too but dunno how it just fixed itself after that
assuming you have updated the gradient to bg-gradient-to-br
@joulev yeah... i would try step 2 above. i actually faced this same issue at first too but dunno how it just fixed itself after that
Pungsan DogOP
So should i create new app and write all the stuff there again
yeah just npx create-next-app@latest
it should ask whether you want tailwindcss, then click yes...

then see if that created app works and if tw classes work there. if they do, just copy your stuff from the old code over
@Pungsan Dog I created new app and installed tailwind while creating the app, but the same error appeared again
That’s odd. So tailwind still doesn’t work?

What if you downgrade nextjs in that new app to say 15.3
Asiatic Lion
latest next js comes with tailwind installed
@Pungsan Dog I tried that too but still not working
that's odd... sorry idk what went wrong
if you are on windows, try WSL
@joulev that's odd... sorry idk what went wrong
Pungsan DogOP
Yeah, but thanks for the help