timonweb / django-tailwind

Django + Tailwind CSS = 💚
https://django-tailwind.readthedocs.io
MIT License
1.44k stars 88 forks source link

Including `tailwind start` in `runserver` command? #198

Open Spaxterr opened 3 months ago

Spaxterr commented 3 months ago

Hello, we are currently looking into implementing tailwind to our Django project. Initially, django-tailwind seems like a good option. However, I noticed that it requires you to run the watcher alongside the Django server. It would be highly beneficial for us if the python3 manage.py tailwind start command could be baked into the python3 manage.py runserver command.

This is because we want to introduce tailwind as seamlessly as possible. The current approach would require us to teach every developer on our team to always start the tailwind watcher as well.

oliverhaas commented 1 month ago

What's wrong with writing your own runserver command? If you want to make it super convenient, you should even be able to override the original one.

willismonroe commented 1 month ago

I tried creating a dev.sh script to run both, but the first command auto-exits soon after the script file is run. Is there a way to get both commands to start in a bash script?

dev.sh (NB: this doesn't work, only runserver stays running):

#!/usr/bin/env bash
# Exit on error
set -o errexit

python3 manage.py tailwind start &
python3 manage.py runserver