Ideas how to support Tailwind CSS 4.x in django-tailwind-cli
Monday, January 20, 2025
Tailwind CSS released its first beta version at the end of November of last year. Since then, I have been thinking about how to implement the changes in the Django library django-tailwind-cli.
Tailwind CSS 4.0 includes some interesting and substantial changes:
- Instead of a tailwind.config.js file, you can configure all of your customizations directly in the CSS file where you import Tailwind.
- Automatic source detection.
- Simplified theme configuration and CSS-first configuration make a lot of customization steps that I normally add to
tailwind.config.js
obsolete, as they just work.
Even though the new version still supports configuring the library using a tailwind.config.js
, I think about introducing some backward incompatible changes for changes.
- The versioning follows the Tailwind CSS library, which means the next release will be 4.×.
- The management sub command
list_templates
is removed. - The configuration variable
TAILWIND_CLI_CONFIG_FILE
is removed. TAILWIND_CLI_SRC_CSS
is changed into a required configuration variable with a sane default.- I am also considering merging the
runserver
andrunserver_plus
management commands into a singlerunserver
command, that has the functionality of therunserver_plus
command. I am still not sure if I want to turndjango-extensions
from an optional into a required dependency.
Furthermore, I am still not sure how to implement the transition. It can be a hard and manual one, or I can try to implement some kind of migration code. The latter is a lot of work and might not work in all situations. The former requires extra work for the users.
Your feedback is welcome. Leave a comment or write me a message on Mastodon or an email.