Tailwind CSS Framework for Django projects
Project description
The integration of Tailwind CSS framework with Django a.k.a. Django + Tailwind = ❤
Quick start
-
Install the python package django-tailwind from pip
pip install django-tailwind
Alternatively, you can download or clone this repo and run
pip install -e .
. -
Add
tailwind
to INSTALLED_APPS in settings.py -
Create a tailwind-compatible Django-app, I like to call it
theme
:python manage.py tailwind init theme
-
Add your newly created
theme
app to INSTALLED_APPS in settings.py -
In settings.py, register tailwind app by adding the following string:
TAILWIND_APP_NAME = 'theme'
-
Run a command to install all necessary dependencies for tailwind css:
python manage.py tailwind install
-
Now, go and start tailwind in dev mode:
python manage.py tailwind start
-
Django Tailwind comes with a simple
base.html
template that can be found underyourtailwindappname/templates/base.html
. You can always extend it or delete it if you have own layout. -
If you're not using
base.html
template provided with Django Tailwind, addstyles.min.css
to your ownbase.html
template file:<link rel="stylesheet" href="{% static 'css/styles.min.css' %}" type="text/css" />
-
You should now be able to use Tailwind CSS classes in your html.
-
To build a production version of CSS run:
python manage.py tailwind build
.
NPM executable path configuration
Sometimes (especially on Windows), Python executable can't find NPM
installed in the system.
In this case, you need to set NPM
executable path in settings.py file manually (Linux/Mac):
NPM_BIN_PATH = '/usr/local/bin/npm'
On windows it might look like:
NPM_BIN_PATH = r"C:\Program Files\nodejs\npm.cmd"
Please note that NPM
path of your system may be different. Try to run which npm
in your
command line to get the path.
Bugs and suggestions
If you have found a bug, please use the issue tracker on GitHub.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_tailwind-0.8.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29d21a1fd3c0b26d26db972060829a77a2723685c8b6a3672d05c4b6e25a4905 |
|
MD5 | 8afea41107d65d00a029b731ca311e33 |
|
BLAKE2b-256 | bfd3da0e983f82f4cb845b606ae260449b4b4209ac1685076c202c0b7128d954 |