Tailwind classes not builded in the deploy #160848
-
Select Topic AreaBug BodyI have this problem where the tailwind classes in my nuxt project, doesn't get builded in the head style of the site. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 4 replies
-
|
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
Beta Was this translation helpful? Give feedback.
-
|
Hey, @Eltymus From what you’re describing, it sounds like Tailwind’s purge (content) config might not be picking up your files correctly during the production build on GitHub Pages. A couple of things to double-check in your content: [
'./components/**/*.{vue,js}',
'./layouts/**/*.vue',
'./pages/**/*.vue',
'./app.vue',
'./plugins/**/*.{js,ts}',
'./nuxt.config.{js,ts}'
]Also, since your site works fine locally with Make sure the deployed build step is actually building with production mode enabled ( If you’ve tried whitelisting classes already and that didn’t work, try temporarily adding a hardcoded test class like Let me know what you find - happy to dig in further if you share which classes specifically are missing! |
Beta Was this translation helpful? Give feedback.
-
|
Ah gotcha - thanks for the extra context! If About - run: NODE_ENV=production npm run buildAlso, I noticed you're deploying with GitHub Pages - maybe try running npm run generateThen push the generated I totally get the feeling of wanting to just start over with a fresh Nuxt+Tailwind template, but I think you’re close here - happy to dig deeper if you want to share the workflow file or exact deployment setup. Let’s figure this out! |
Beta Was this translation helpful? Give feedback.
-
|
Hey, thanks for the kind words - and I really respect your persistence! About - name: Build project
run: |
NODE_ENV=production npm run generateThis way it only applies during the build process. export default defineNuxtConfig({
ssr: false,
target: 'static',
})And you might want to double check your You're definitely close, and I’m happy to help you finish this - don’t hesitate to keep testing things out and ping me if you get stuck again. You’ve got this. |
Beta Was this translation helpful? Give feedback.
-
|
This issue usually happens when Tailwind isn’t detecting your files correctly during the production build, so the required Tailwind color class names are being purged and never included in the final CSS. Double-check the content paths in your Tailwind config, ensure dynamic class names are safelisted, and verify that your Nuxt build environment matches local settings. |
Beta Was this translation helpful? Give feedback.
Hey, thanks for the kind words - and I really respect your persistence!
I just took a look at your Actions history, and yeah, I can see you’ve been testing different configs (which is great).
About
NODE_ENV, yeah - it needs to be set inside the samerun:block where you call the build command.For example:
This way it only applies during the build process.
Setting it as a separate step like
- name: Set envwon’t have the same effect unless you export it in the shell or useenv:correctly.Also just a heads-up: since you're using
nuxt generate, make sure yournuxt.config.tshas the right deployment target: