You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(config): support system-installed Tailwind CSS CLI
Add TAILWIND_CLI_USE_SYSTEM_BINARY (opt-in) so users with a tailwindcss
binary already on PATH — e.g. installed via Homebrew — can skip the
automatic download entirely. The binary is resolved via shutil.which(),
which works uniformly across Intel/ARM macOS, Linuxbrew and system
package managers without hardcoding paths.
When enabled:
- The download flow is bypassed in _download_cli_with_verbose(); no
network calls, no files under TAILWIND_CLI_PATH.
- remove_cli refuses to delete the binary, since the library did not
install it.
- The tailwind config command reports the origin ("system binary" vs
"managed download") and lists the new settings.
- If TAILWIND_CLI_VERSION is pinned and the installed binary reports a
different version, a UserWarning is emitted. No warning when VERSION
is "latest" (user has no explicit expectation) or when version
detection fails (subprocess error, unparseable output).
Version detection runs `<binary> --help` and parses the first line of
stdout. The --version flag is deliberately not used: unknown flags are
interpreted by the CLI as a build invocation.
Optional TAILWIND_CLI_SYSTEM_BINARY_NAME lets users override the
executable name; defaults to "tailwindcss", or "tailwindcss-extra" when
DaisyUI is enabled. Mutually exclusive with TAILWIND_CLI_PATH.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@
4
4
5
5
### 🎯 New Features
6
6
-**Configurable minification**: New `TAILWIND_CLI_AUTOMATIC_MINIFY` setting and `--minify` / `--no-minify` flag on `tailwind build` for projects whose asset pipelines already minify CSS. Defaults preserve existing behavior.
7
+
-**System binary support**: New `TAILWIND_CLI_USE_SYSTEM_BINARY` setting lets `django-tailwind-cli` use a Tailwind CSS CLI that is already installed on `PATH` (e.g. via Homebrew), skipping the auto-download. Pairs with optional `TAILWIND_CLI_SYSTEM_BINARY_NAME` override. Emits a warning if the installed binary's version differs from an explicitly pinned `TAILWIND_CLI_VERSION`.
7
8
8
9
### 🛠️ Developer Experience
9
10
-**Gitignore cleanup**: Trimmed `.gitignore` to project-relevant entries only
Copy file name to clipboardExpand all lines: docs/installation.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,17 @@
69
69
70
70
## Optional steps
71
71
72
+
### Use a system-installed Tailwind CSS CLI
73
+
74
+
By default, `django-tailwind-cli` downloads the Tailwind CSS CLI binary on first use and caches it inside your project. If you already have `tailwindcss` installed through [Homebrew](https://formulae.brew.sh/formula/tailwindcss) or another package manager, you can tell the library to use that binary instead and skip the download:
75
+
76
+
```python
77
+
# settings.py
78
+
TAILWIND_CLI_USE_SYSTEM_BINARY=True
79
+
```
80
+
81
+
See [`TAILWIND_CLI_USE_SYSTEM_BINARY`](settings.md#tailwind_cli_use_system_binary) for details.
82
+
72
83
### Install `django-browser-reload`
73
84
74
85
If you enjoy automatic reloading during development. Install the [django-browser-reload](https://github.com/adamchainz/django-browser-reload) app. The following installation steps are taken from the README of the project.
Copy file name to clipboardExpand all lines: docs/settings.md
+48Lines changed: 48 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,39 @@ In case you want to use the new behaviour, it is highly recommended to also set
42
42
43
43
Enable or disable the automatic downloading of the official CLI to your machine.
44
44
45
+
### TAILWIND_CLI_USE_SYSTEM_BINARY
46
+
47
+
**Default**: `False`
48
+
49
+
If set to `True`, the library uses a Tailwind CSS CLI that is already installed on your system's `PATH` (for example via [Homebrew](https://formulae.brew.sh/formula/tailwindcss) or a system package manager) instead of downloading its own copy. The binary is resolved with Python's `shutil.which()`, so it works on any platform as long as the executable is reachable via `PATH`.
50
+
51
+
When enabled:
52
+
53
+
- The automatic download is skipped entirely — no network calls, no files created under `TAILWIND_CLI_PATH`.
54
+
-`python manage.py tailwind remove_cli` refuses to delete the binary (since the library did not install it).
55
+
- If `TAILWIND_CLI_VERSION` is pinned to a specific version and the system binary reports a different version, a warning is emitted so you can reconcile the discrepancy. No warning is issued when `TAILWIND_CLI_VERSION = "latest"`.
56
+
57
+
```python
58
+
# settings.py
59
+
TAILWIND_CLI_USE_SYSTEM_BINARY=True
60
+
```
61
+
62
+
:::{warning}
63
+
`TAILWIND_CLI_USE_SYSTEM_BINARY` is **mutually exclusive** with `TAILWIND_CLI_PATH`. Use one or the other.
64
+
:::
65
+
66
+
### TAILWIND_CLI_SYSTEM_BINARY_NAME
67
+
68
+
**Default**: `"tailwindcss"` (or `"tailwindcss-extra"` when `TAILWIND_CLI_USE_DAISY_UI = True`)
69
+
70
+
Overrides the executable name that is looked up on `PATH` when `TAILWIND_CLI_USE_SYSTEM_BINARY = True`. You rarely need to set this — the default picks the right name automatically.
@@ -285,6 +318,21 @@ In your templates, include all CSS files or filter by name:
285
318
286
319
The `build` command processes all entries, and the `watch` command monitors all source files simultaneously.
287
320
321
+
### Using a Homebrew-installed Tailwind CSS CLI
322
+
323
+
If you have already installed `tailwindcss` through [Homebrew](https://formulae.brew.sh/formula/tailwindcss) (or any other package manager that puts it on your `PATH`), you can skip the automatic download entirely:
324
+
325
+
```bash
326
+
brew install tailwindcss
327
+
```
328
+
329
+
```python
330
+
# settings.py
331
+
TAILWIND_CLI_USE_SYSTEM_BINARY = True
332
+
```
333
+
334
+
That's it — the library resolves `tailwindcss` via `PATH` on every invocation and runs your builds against that binary. Pairs well with `TAILWIND_CLI_VERSION = "latest"` so you don't have to update two places when Homebrew bumps the version.
335
+
288
336
### Staging Environment
289
337
290
338
Balanced between dev flexibility and prod stability:
0 commit comments