Skip to main content

Tailwind CSS Framework for Django projects

Project description

The integration of Tailwind CSS framework with Django a.k.a. Django + Tailwind = ❤

Quick start

  1. 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 ..

  2. Add tailwind to INSTALLED_APPS in settings.py

  3. Create a tailwind-compatible Django-app, I like to call it theme:

    python manage.py tailwind init theme

  4. Add your newly created theme app to INSTALLED_APPS in settings.py

  5. In settings.py, register tailwind app by adding the following string:

    TAILWIND_APP_NAME = 'theme'

  6. Run a command to install all necessary dependencies for tailwind css:

    python manage.py tailwind install

  7. Now, go and start tailwind in dev mode:

    python manage.py tailwind start

  8. Django Tailwind comes with a simple base.html template that can be found under yourtailwindappname/templates/base.html. You can always extend it or delete it if you have own layout.

  9. If you're not using base.html template provided with Django Tailwind, add styles.min.css to your own base.html template file:

    <link
      rel="stylesheet"
      href="{% static 'css/styles.min.css' %}"
      type="text/css"
    />
    
  1. You should now be able to use Tailwind CSS classes in your html.

  2. 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:

NPM_BIN_PATH = '/usr/local/bin/npm'

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.

https://github.com/timonweb/django-tailwind/issues

2019 (c) Tim Kamanin - A Full Stack Django Developer

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-tailwind-0.5.5.tar.gz (43.8 kB view details)

Uploaded Source

File details

Details for the file django-tailwind-0.5.5.tar.gz.

File metadata

  • Download URL: django-tailwind-0.5.5.tar.gz
  • Upload date:
  • Size: 43.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.15

File hashes

Hashes for django-tailwind-0.5.5.tar.gz
Algorithm Hash digest
SHA256 75f992946e9f667a88b29aa198efacd30687427836624dd4b3d2875205dd4d08
MD5 39e5f9c5ad8e3f13a7c5953d6c73978b
BLAKE2b-256 85f9cf60c749b7de2f05ece75a58a1d9753ca6e372b9db55207a02d5595edf6b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page