Skip to content

Commit d86e4a5

Browse files
committed
Updates docs
1 parent 0308973 commit d86e4a5

File tree

3 files changed

+67
-10
lines changed

3 files changed

+67
-10
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313

1414
This project provides a convenient way to integrate the *Tailwind CSS* framework into a Django project.
1515
It creates a new Django app (named theme by default) that includes all the necessary files and configurations to get
16-
started with *Tailwind CSS* quickly.
16+
started with *Tailwind CSS* quickly and **without even needing to install `Node.js`** if you choose the standalone binary mode.
1717

1818
## Features
1919

2020
* An opinionated *Tailwind CSS* setup that makes your life easier;
21-
* **Two installation modes:** standalone binary (no `Node.js` required) or npm-based (`Node.js` required);
21+
* **Two installation modes:** standalone binary (works without `Node.js`) or npm-based (`Node.js` required);
2222
* Hot reloading of CSS, configuration files, and *Django* templates. No more manual page refreshes!
23-
* Out of the box support for CSS imports, Sass-like variables, and nesting;
23+
* Out of the box support for CSS imports and nesting;
2424
* Supports the latest *Tailwind CSS* `v4.x`;
2525
* Start both *Tailwind CSS* and *Django* development servers with a single command;
2626
* An optional DaisyUI integration to spice up your Tailwind templates with pre-built components.
@@ -30,7 +30,7 @@ started with *Tailwind CSS* quickly.
3030

3131
Python 3.11 or newer and Django 4.2.20 or newer.
3232

33-
**Note:** Node.js is only required if you choose the npm-based installation. The standalone binary mode does not require Node.js.
33+
**Note:** `Node.js` is only required if you choose the npm-based installation. The standalone binary mode does not require Node.js.
3434

3535
## Documentation
3636

docs/settings.md

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ python manage.py tailwind init
1010
```
1111
Please refer to the [Installation](installation.md) section for more information on the installation process.
1212

13-
## `TAILWIND_DEV_MODE` (deprecated)
14-
Determines whether the `browser-sync` snippet is added to the page via the `{% tailwind_css %}` tag. It is set to `False` by default. If you use a legacy pre-`3.1.0` configuration and rely on `browser-sync`, add `TAILWIND_DEV_MODE=True` to your `settings.py`.
15-
1613
## `NPM_BIN_PATH` (npm-based installation only)
1714

1815
> **Note:** This setting only applies to npm-based installations. Skip if using the standalone binary mode.
@@ -79,6 +76,54 @@ After changing this setting, run `python manage.py tailwind install` to download
7976

8077
Visit the [Tailwind CSS releases page](https://github.com/tailwindlabs/tailwindcss/releases) to see all available versions. Use the tag name (e.g., `v4.1.16`) as the value for this setting.
8178

79+
## `TAILWIND_STANDALONE_START_COMMAND_ARGS`
80+
81+
> **Note:** This setting only applies when using standalone binary mode.
82+
83+
This setting defines the command-line arguments passed to the Tailwind CSS standalone binary when running in watch mode (via `python manage.py tailwind start`).
84+
85+
The default value is:
86+
```python
87+
TAILWIND_STANDALONE_START_COMMAND_ARGS = (
88+
"-i static_src/src/styles.css -o static/css/dist/styles.css --watch"
89+
)
90+
```
91+
92+
You can customize this to use different input/output paths or add additional Tailwind CLI options:
93+
94+
```python
95+
# settings.py
96+
TAILWIND_STANDALONE_START_COMMAND_ARGS = (
97+
"-i theme/static_src/input.css -o theme/static/output.css --watch --minify"
98+
)
99+
```
100+
101+
> **Note:** The output path automatically uses the value from `TAILWIND_CSS_PATH` in the default configuration. If you override this setting, ensure your paths are correct.
102+
103+
## `TAILWIND_STANDALONE_BUILD_COMMAND_ARGS`
104+
105+
> **Note:** This setting only applies when using standalone binary mode.
106+
107+
This setting defines the command-line arguments passed to the Tailwind CSS standalone binary when building for production (via `python manage.py tailwind build`).
108+
109+
The default value is:
110+
```python
111+
TAILWIND_STANDALONE_BUILD_COMMAND_ARGS = (
112+
"-i static_src/src/styles.css -o static/css/dist/styles.css --minify"
113+
)
114+
```
115+
116+
You can customize this to use different input/output paths or modify build options:
117+
118+
```python
119+
# settings.py
120+
TAILWIND_STANDALONE_BUILD_COMMAND_ARGS = (
121+
"-i theme/static_src/input.css -o theme/static/output.css --minify --optimize"
122+
)
123+
```
124+
125+
> **Note:** The output path automatically uses the value from `TAILWIND_CSS_PATH` in the default configuration. If you override this setting, ensure your paths match your project structure.
126+
82127
## `TAILWIND_CSS_PATH`
83128
This defines the path to the generated *Tailwind CSS* stylesheet. If you created a theme app via the `python manage.py tailwind init` command, you likely don't need to change this value.
84129

@@ -88,3 +133,6 @@ The default value is:
88133
```python
89134
TAILWIND_CSS_PATH = "css/dist/styles.css"
90135
```
136+
137+
## `TAILWIND_DEV_MODE` (deprecated)
138+
Determines whether the `browser-sync` snippet is added to the page via the `{% tailwind_css %}` tag. It is set to `False` by default. If you use a legacy pre-`3.1.0` configuration and rely on `browser-sync`, add `TAILWIND_DEV_MODE=True` to your `settings.py`.

src/tailwind/__init__.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55

66
def get_config(setting_name):
7+
tailwind_css_path = "css/dist/styles.css"
78
return {
89
"NPM_BIN_PATH": getattr(settings, "NPM_BIN_PATH", "npm"),
910
# 'TAILWIND_DEV_MODE' is deprecated. Leaving it here
1011
# to support legacy browser-sync based configs.
1112
"TAILWIND_DEV_MODE": getattr(settings, "TAILWIND_DEV_MODE", False),
12-
"TAILWIND_CSS_PATH": getattr(settings, "TAILWIND_CSS_PATH", "css/dist/styles.css"),
13+
"TAILWIND_CSS_PATH": getattr(settings, "TAILWIND_CSS_PATH", tailwind_css_path),
1314
"TAILWIND_APP_NAME": getattr(settings, "TAILWIND_APP_NAME", None),
1415
"TAILWIND_USE_STANDALONE_BINARY": getattr(
1516
settings, "TAILWIND_USE_STANDALONE_BINARY", False
@@ -19,6 +20,14 @@ def get_config(setting_name):
1920
"TAILWIND_STANDALONE_BINARY_VERSION",
2021
os.environ.get("TAILWINDCSS_VERSION", "v4.1.16"),
2122
),
22-
"TAILWIND_STANDALONE_START_COMMAND_ARGS": "-i static_src/src/styles.css -o static/css/dist/styles.css --watch",
23-
"TAILWIND_STANDALONE_BUILD_COMMAND_ARGS": "-i static_src/src/styles.css -o static/css/dist/styles.css --minify",
23+
"TAILWIND_STANDALONE_START_COMMAND_ARGS": getattr(
24+
settings,
25+
"TAILWIND_STANDALONE_START_COMMAND_ARGS",
26+
f"-i static_src/src/styles.css -o static/{tailwind_css_path} --watch",
27+
),
28+
"TAILWIND_STANDALONE_BUILD_COMMAND_ARGS": getattr(
29+
settings,
30+
"TAILWIND_STANDALONE_BUILD_COMMAND_ARGS",
31+
f"-i static_src/src/styles.css -o static/{tailwind_css_path} --minify",
32+
),
2433
}[setting_name]

0 commit comments

Comments
 (0)