litestar-tailwind-cli
Provides a CLI plugin for Litestar to use Tailwind CSS via the Tailwind CLI.
Table of Contents
Installation
pip install litestar-tailwind-cli
Usage
Configure and include the TailwindCLIPlugin in your Litestar app:
from pathlib import Path
from litestar import Litestar
from litestar.static_files import create_static_files_router
from litestar.contrib.jinja import JinjaTemplateEngine
from litestar.template.config import TemplateConfig
from litestar_tailwind_cli import TailwindCLIPlugin
ASSETS_DIR = Path("assets")
tailwind_cli = TailwindCLIPlugin(
use_server_lifespan=True,
src_css=ASSETS_DIR / "css" / "input.css",
dist_css=ASSETS_DIR / "css" / "tailwind.css",
)
app = Litestar(
route_handlers=[create_static_files_router(path="/static", directories=["assets"])],
debug=True,
plugins=[tailwind_cli],
template_config=TemplateConfig(
directory=Path("templates"),
engine=JinjaTemplateEngine,
),
)
<head>
...
<link rel="stylesheet" href="/static/css/tailwind.css">
</head>
After setting up, you can use the following commands:
litestar tailwind init: This command initializes the tailwind configuration and downloads the CLI if it's not already installed.litestar tailwind watch: This command starts the Tailwind CLI in watch mode during development. You won't have to use this if you setuse_server_lifespantoTrue.litestar tailwind build: This command builds a minified production-ready CSS file.
The TailwindCLIPlugin has the following configuration options:
src_css: The path to the source CSS file. Defaults to "css/input.css".dist_css: The path to the distribution CSS file. Defaults to "css/tailwind.css".config_file: The path to the Tailwind configuration file. Defaults to "tailwind.config.js".use_server_lifespan: Whether to use server lifespan. Defaults toFalse. It will start the Tailwind CLI in watch mode when you use thelitestar runcommand.cli_version: The version of the Tailwind CLI to download. Defaults to "latest".src_repo: The GitHub repository from which to download the Tailwind CLI. Defaults totailwindlabs/tailwindcss.asset_name: The name of the asset to download from the repository. Defaults totailwindcss.
For example, if you are using the repository https://github.com/dobicinaitis/tailwind-cli-extra/tree/main, you would set src_repo to "dobicinaitis/tailwind-cli-extra" and asset_name to "tailwindcss-extra".
License
litestar-tailwind-cli is distributed under the terms of the MIT license.
Metadata
Release files for litestar-tailwind-cli 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| litestar_tailwind_cli-0.2.0.tar.gz | 13.8 kB | Without provenance | Details for litestar_tailwind_cli-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| litestar_tailwind_cli-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for litestar_tailwind_cli-0.2.0-py3-none-any.whl |
Total release size: 21.3 kB
Release files / litestar_tailwind_cli-0.2.0.tar.gz
| Download URL | litestar_tailwind_cli-0.2.0.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
972b0a21259ce8d176beaf07c46f8c10b5fbe2b7ca4c5aa92a7322b175f0f3b1
|
|
BLAKE2b-256 checksum How to use checksums |
80df12091f9c3dbba4a827fb419716fc2e13b4af6a285a34b7a98a6bcd1f56fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.0
|
Release files / litestar_tailwind_cli-0.2.0-py3-none-any.whl
| Download URL | litestar_tailwind_cli-0.2.0-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
486f168cf8b0fe95326f7c0ea41b284081f563a90cbfbcc0feff31ad83eb5515
|
|
BLAKE2b-256 checksum How to use checksums |
a96b5d3a3d74fe8b15d06cf85ad029e7f4caf18a9a522111ad6fa1d56fce6bc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.0
|
Security for litestar-tailwind-cli 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.