A simple starter kit for integrating TailwindCss in Django
git clone https://github.com/MindMansion/DjangoTailwindStarter.git
cd DjangoTailwindStarter
python3 -m venv virtual-env
python -m venv virtual-env # on windows
# activate env
source virtual-env/bin/activate
pip install -r requirements.txt
cd theme
npm install
npm run build
npm run watch # to keep the scss watcher alive
from a new terminal window run:
python3 manage.py runserver
Then visit the link in your browser http://127.0.0.1:8000
If you already have a Django project, and you're only interested in including tailwind in your project, follow these steps.
mkdir theme
cd theme
This will add a global.css
file to your static
directory.
npx degit https://github.com/MindMansion/DjangoTailwindStarter/theme
npm install
npm run build
npm run watch
Add the CSS file to your head tag
link rel="stylesheet" href="{% static 'css/global.css' %}">