-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.dark section not included in tailwind output #515
Comments
This is definitely caused by Tailwind CSS's stupid purge engine! You can fix it by https://tailwindcss.com/docs/content-configuration#safelisting-classes module.exports = {
darkMode: ["class"],
content: ["app/**/*.{ts,tsx}", "components/**/*.{ts,tsx}"],
safelist: ["dark"],
theme: {
// ...
},
plugins: [require("tailwindcss-animate")],
} |
Great workaround, thanks @mogeko . Do you happen to know why this may happen? |
Of course! @tonyxiao, Tailwind CSS will automatically delete those unused CSS to keep the package thin. However, this should not happen when you set I have encountered the same problem for unknown reason before, I used |
I encountered the same problem, and fixed it by moving the CSS out of the layer declaration. As far as I can tell, https://ui.shadcn.com/ uses the CSS variables approach as well, and inspecting the website shows the |
I fixed it by removing |
Doing that actually breaks more things, this is the correct way to fix this |
Thanks for the comment, but your referenced solution does not fix it for me. Only thing working so far is what I described above. |
This is probably not a shadcn problem but I could really use some help figuring it out. For some reason my dark mode does not work because the css variables
.dark
inglobal.css
that shadcn uses never get included in the final css output of tailwind. If I manually add it to theclassName
ofhtml
element then it works, but of course that doesn't work because it prevents switching. Anyone got idea why tailwind would exclude.dark
section from output even though thetailwind.config.js
usesdarkMode: class
?The text was updated successfully, but these errors were encountered: