|
2 | 2 |  |
3 | 3 |
|
4 | 4 | ## Goal |
5 | | -This project aims to provide a comfortable way of using the *Tailwind CSS* framework within a Django project. |
| 5 | +This project aims to provide a convenient way to use the *Tailwind CSS* framework within a Django project. |
6 | 6 |
|
7 | 7 | ## Features |
8 | 8 | * An opinionated *Tailwind CSS* setup that makes your life easier; |
9 | 9 | * Hot reloading of CSS, configuration files, and *Django* templates. No more manual page refreshes! |
10 | | -* Out of the box support for CSS imports, SASS-like variables, and nesting; |
| 10 | +* Out of the box support for CSS imports, Sass-like variables, and nesting; |
11 | 11 | * Supports the latest *Tailwind CSS* `v4.x`; |
12 | 12 | * Start both *Tailwind CSS* and *Django* development servers with a single command; |
13 | 13 |
|
14 | 14 | ## Requirements |
15 | | -Python 3.10 or newer with Django >= 4.2.20 or newer. |
| 15 | +Python 3.10 or newer and Django 4.2.20 or newer. |
16 | 16 |
|
17 | 17 | ## Documentation |
18 | | -The full documentation is at https://django-tailwind.readthedocs.io/ |
| 18 | +The full documentation is at https://django-tailwind.readthedocs.io/ or in the [docs directory](docs/index.md) of this repository. |
19 | 19 |
|
20 | | -## Installation |
21 | | -Via PIP: |
22 | | -```bash |
23 | | -pip install django-tailwind |
24 | | -``` |
| 20 | +## Getting Started |
25 | 21 |
|
26 | | -[RECOMMENDED IN DEV] If you want to use automatic page reloads during development use the `[reload]` extras, which installs the `django-browser-reload` package in addition: |
| 22 | +1. **Install django-tailwind:** |
| 23 | + ```bash |
| 24 | + pip install django-tailwind |
| 25 | + ``` |
27 | 26 |
|
28 | | - ```bash |
29 | | - pip install 'django-tailwind[reload]' |
30 | | - ``` |
| 27 | +2. **Add to INSTALLED_APPS in settings.py:** |
| 28 | + ```python |
| 29 | + INSTALLED_APPS = [ |
| 30 | + # ... |
| 31 | + 'tailwind', |
| 32 | + ] |
| 33 | + ``` |
31 | 34 |
|
32 | | -Check docs for the [Installation](https://django-tailwind.readthedocs.io/en/latest/installation.html) instructions. |
| 35 | +3. **Create Tailwind app:** |
| 36 | + ```bash |
| 37 | + python manage.py tailwind init |
| 38 | + ``` |
| 39 | + |
| 40 | +4. **Add the generated app to INSTALLED_APPS and configure:** |
| 41 | + ```python |
| 42 | + INSTALLED_APPS = [ |
| 43 | + # ... |
| 44 | + 'tailwind', |
| 45 | + 'theme', # your generated app name |
| 46 | + ] |
| 47 | + |
| 48 | + TAILWIND_APP_NAME = 'theme' |
| 49 | + ``` |
| 50 | + |
| 51 | +5. **Install Tailwind CSS dependencies:** |
| 52 | + ```bash |
| 53 | + python manage.py tailwind install |
| 54 | + ``` |
| 55 | + |
| 56 | +6. **Start development (runs Django + Tailwind):** |
| 57 | + ```bash |
| 58 | + python manage.py tailwind dev |
| 59 | + ``` |
| 60 | + |
| 61 | +7. **Use Tailwind classes in your templates:** |
| 62 | + ```html |
| 63 | + {% load tailwind_tags %} |
| 64 | + <link href="{% tailwind_css %}" rel="stylesheet"> |
| 65 | + |
| 66 | + <h1 class="text-4xl font-bold text-blue-600">Hello Tailwind!</h1> |
| 67 | + ``` |
| 68 | + |
| 69 | +That's it! 🎉 Your Django project now has Tailwind CSS with hot reloading. |
| 70 | + |
| 71 | +For configuring automatic page reloads during development, see the [Installation](docs/installation.md) instructions. |
33 | 72 |
|
34 | 73 | ## Bugs and suggestions |
35 | 74 |
|
|
0 commit comments