Skip to main content

A library for easy setup of tailwind in django project

Project description

How to setup the library

This guide will take you through the steps to integrate Tailwind CSS into your Django project, including the necessary configurations, installing dependencies, and compiling CSS files. In the end, you will have a development-ready system with Tailwind CSS integrated.

Before starting, make sure you are in the main project folder

Step 1

Paste the following code in your terminal to download the library in your project. Windows:

pip  install  tailwind_for_django

Mac:

pip3  install  tailwind_for_django

Step 2

In your settings.py the following line in the INSTALLED_APPS array.

'tailwind_for_django'

Step 3

Now run the following command:

If you are in window:

python manage.py setup_tailwind

If you are in mac:

python3 manage.py setup_tailwind

Step 4

Update your settings.py with this 2 line of code:

STATIC_URL = '/static/'
STATICFILES_DIRS = [BASE_DIR / 'static']

Step 5

Enter in static -> css -> input_tailwind.css and remove the example line (the line start with //)

Step 6

Run the following script:

npm run build_tailwind

Step 7

In your templates insert the following code:

{% load static %}
<link  href="{% static 'css/output_tailwind.css' %}"  rel="stylesheet">

If you have some cache problem and your template style not update pass at your view time and change to the following code

{% load static %}
<link  href="{% static 'css/output_tailwind.css' %}?v={{  time.time  }}"  rel="stylesheet">

Final

Now you have tailwindcss installed on your django project.

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

tailwind_for_django-0.1.7.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tailwind_for_django-0.1.7-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file tailwind_for_django-0.1.7.tar.gz.

File metadata

  • Download URL: tailwind_for_django-0.1.7.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for tailwind_for_django-0.1.7.tar.gz
Algorithm Hash digest
SHA256 e6178ea4ce45e756275dd65db1fb93ee5f6a86f19a01698cc7e3e4e84d766f8b
MD5 373771621315e53682f481b567954529
BLAKE2b-256 b2fc83e92bba34f9b6227930b586e10c7a9d3f3f32dbced2ebe67e54f86f669e

See more details on using hashes here.

File details

Details for the file tailwind_for_django-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for tailwind_for_django-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d4e896e0aa0f1fbc6254ed027d22254e47669eb8fa0603d0efd5ba1b04b961dc
MD5 6303fa3d534082032d91be73e0784e5b
BLAKE2b-256 e317675a704657cd4f92cc31f61ed92a4af8b066e8bc5ae3ea127d91cfaf7c71

See more details on using hashes here.

Supported by

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