-
Notifications
You must be signed in to change notification settings - Fork 105
Description
👋 Hello!
I’m using django-tailwind
(v4.2.0) with TailwindCSS v4 in my Django project.
Everything works perfectly in templates located inside the theme
app (theme/templates/**
).
But styles are not applied in templates from other apps, e.g., app2/templates/app2/app2.html
.
🌱 My setup:
- Django: 5.2
- django-tailwind: 4.2.0
- TailwindCSS: 4.x (CSS-first approach, no
tailwind.config.js
) - DaisyUI: 5.x
- PostCSS enabled with the following
postcss.config.js
:
module.exports = {
plugins: {
"@tailwindcss/postcss": {
content: [
"../../templates/**/*.html", // project-level templates
"../../*/templates/**/*.html", // app-level templates
"../../**/*.html", // fallback
],
},
autoprefixer: {},
},
}
❓ Problem
TailwindCSS classes (like text-blue-600
) and DaisyUI components (like btn btn-primary
) only work in templates under theme/templates/**
.
They do not apply in templates of other Django apps (e.g., app2
, app3
), even though I added their paths in content
.
Moving templates from app2
into theme/templates/app2/
also did not help — classes are still purged unless I restart tailwind build
manually.
💡 Question
How can I make TailwindCSS and DaisyUI styles available in all templates across my Django project? Should I:
✅ Add each app’s templates path manually to PostCSS?
✅ Create a tailwind.config.js
even if I prefer CSS-first?
✅ Use another workflow for multiple Django apps?
✅ Or is there a recommended way to configure django-tailwind for this?
🚀 Expected Result
TailwindCSS and DaisyUI styles should be applied in any Django template, whether it is inside theme/templates
or another app’s templates
folder.
Thank you for your help! 🙏