litestar-tailwind


Namelitestar-tailwind JSON
Version 0.2.3 PyPI version JSON
download
home_pageNone
SummaryProvides a CLI plugin for Litestar to use Tailwind CSS via the Tailwind CLI.
upload_time2025-08-04 19:37:44
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords litestar tailwindcss
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # litestar-tailwind
forked from Tobi-De/litestar-tailwind-cli with improves

[![PyPI - Version](https://img.shields.io/pypi/v/litestar-tailwind-cli.svg)](https://pypi.org/project/litestar-tailwind-cli)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/litestar-tailwind-cli.svg)](https://pypi.org/project/litestar-tailwind-cli)

-----

> [!IMPORTANT]
> This plugin currently contains minimal features and is a work-in-progress

Provides a CLI plugin for [Litestar](https://litestar.dev) to use [Tailwind CSS](https://tailwindcss.com) via the Tailwind CLI.

## Table of Contents

- [litestar-tailwind](#litestar-tailwind)
  - [Table of Contents](#table-of-contents)
  - [Installation](#installation)
  - [Usage](#usage)
  - [License](#license)
  - [Changes from original](#changes-from-original)

## Installation

```console
pip install litestar-tailwind
```

## Usage

Configure and include the `TailwindCLIPlugin` in your Litestar app:

```python
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,
    ),
)
```

```jinja
<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 set `use_server_lifespan` to `True`.
- `litestar tailwind build`: This command builds a minified production-ready CSS file.

> [!NOTE]
> Don't forget to update the `content` key in `tailwind.config.js` to specify your templates directories.

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 to `False`. It will start the Tailwind CLI in watch mode when you use the `litestar run` command.
- `conventional_path_resolve`: Only use the existing implementation for Tailwind CLI searches. defaults to `True`.
- `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 to `tailwindlabs/tailwindcss`.
- `asset_name`: The name of the asset to download from the repository. Defaults to `tailwindcss`.

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` and `litestar-tailwind-cli` (original library) is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
 is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

## Changes from Original
- litestar-tailwind now supports tailwindcss v4. v3 is no longer supported.
- You can now use `{% tailwind_css() %}` to get the location of TailwindCSS's dist CSS. However, TailwindCSS files must be located under the web server's URI, `static`.
- By using `{% load_tailwind() %}`, you can now automatically load TailwindCSS. However, the same requirements apply as when using `{% tailwind_css() %}`.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "litestar-tailwind",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Aoi <aoicistus@gmail.com>",
    "keywords": "litestar, tailwindcss",
    "author": null,
    "author_email": "Tobi DEGNON <tobidegnon@proton.me>",
    "download_url": "https://files.pythonhosted.org/packages/b2/23/84f92b5b31140c4d65ee59b78dbd4a144b1ed33fddd785f852749968dc85/litestar_tailwind-0.2.3.tar.gz",
    "platform": null,
    "description": "# litestar-tailwind\nforked from Tobi-De/litestar-tailwind-cli with improves\n\n[![PyPI - Version](https://img.shields.io/pypi/v/litestar-tailwind-cli.svg)](https://pypi.org/project/litestar-tailwind-cli)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/litestar-tailwind-cli.svg)](https://pypi.org/project/litestar-tailwind-cli)\n\n-----\n\n> [!IMPORTANT]\n> This plugin currently contains minimal features and is a work-in-progress\n\nProvides a CLI plugin for [Litestar](https://litestar.dev) to use [Tailwind CSS](https://tailwindcss.com) via the Tailwind CLI.\n\n## Table of Contents\n\n- [litestar-tailwind](#litestar-tailwind)\n  - [Table of Contents](#table-of-contents)\n  - [Installation](#installation)\n  - [Usage](#usage)\n  - [License](#license)\n  - [Changes from original](#changes-from-original)\n\n## Installation\n\n```console\npip install litestar-tailwind\n```\n\n## Usage\n\nConfigure and include the `TailwindCLIPlugin` in your Litestar app:\n\n```python\nfrom pathlib import Path\n\nfrom litestar import Litestar\nfrom litestar.static_files import create_static_files_router\nfrom litestar.contrib.jinja import JinjaTemplateEngine\nfrom litestar.template.config import TemplateConfig\nfrom litestar_tailwind_cli import TailwindCLIPlugin\n\nASSETS_DIR = Path(\"assets\")\n\ntailwind_cli = TailwindCLIPlugin(\n  use_server_lifespan=True,\n  src_css=ASSETS_DIR / \"css\" / \"input.css\",\n  dist_css=ASSETS_DIR / \"css\" / \"tailwind.css\",\n)\n\napp = Litestar(\n    route_handlers=[create_static_files_router(path=\"/static\", directories=[\"assets\"])],\n    debug=True,\n    plugins=[tailwind_cli],\n    template_config=TemplateConfig(\n        directory=Path(\"templates\"),\n        engine=JinjaTemplateEngine,\n    ),\n)\n```\n\n```jinja\n<head>\n...\n  <link rel=\"stylesheet\" href=\"/static/css/tailwind.css\">\n</head>\n```\n\nAfter setting up, you can use the following commands:\n\n- `litestar tailwind init`: This command initializes the tailwind configuration and downloads the CLI if it's not already installed.\n- `litestar tailwind watch`: This command starts the Tailwind CLI in watch mode during development. You won't have to use this if you set `use_server_lifespan` to `True`.\n- `litestar tailwind build`: This command builds a minified production-ready CSS file.\n\n> [!NOTE]\n> Don't forget to update the `content` key in `tailwind.config.js` to specify your templates directories.\n\nThe `TailwindCLIPlugin` has the following configuration options:\n\n- `src_css`: The path to the source CSS file. Defaults to \"css/input.css\".\n- `dist_css`: The path to the distribution CSS file. Defaults to \"css/tailwind.css\".\n- `config_file`: The path to the Tailwind configuration file. Defaults to \"tailwind.config.js\".\n- `use_server_lifespan`: Whether to use server lifespan. Defaults to `False`. It will start the Tailwind CLI in watch mode when you use the `litestar run` command.\n- `conventional_path_resolve`: Only use the existing implementation for Tailwind CLI searches. defaults to `True`.\n- `cli_version`: The version of the Tailwind CLI to download. Defaults to \"latest\".\n- `src_repo`: The GitHub repository from which to download the Tailwind CLI. Defaults to `tailwindlabs/tailwindcss`.\n- `asset_name`: The name of the asset to download from the repository. Defaults to `tailwindcss`.\n\nFor 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\"`.\n\n## License\n\n`litestar-tailwind` and `litestar-tailwind-cli` (original library) is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n\n## Changes from Original\n- litestar-tailwind now supports tailwindcss v4. v3 is no longer supported.\n- You can now use `{% tailwind_css() %}` to get the location of TailwindCSS's dist CSS. However, TailwindCSS files must be located under the web server's URI, `static`.\n- By using `{% load_tailwind() %}`, you can now automatically load TailwindCSS. However, the same requirements apply as when using `{% tailwind_css() %}`.",
    "bugtrack_url": null,
    "license": null,
    "summary": "Provides a CLI plugin for Litestar to use Tailwind CSS via the Tailwind CLI.",
    "version": "0.2.3",
    "project_urls": {
        "Documentation": "https://github.com/aoi-cistus/litestar-tailwind#readme",
        "Issues": "https://github.com/aoi-cistus/litestar-tailwind/issues",
        "Source": "https://github.com/aoi-cistus/litestar-tailwind"
    },
    "split_keywords": [
        "litestar",
        " tailwindcss"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e658d5366908c737d0c3d9e5225be3456c4960ba691547d905e7e07537fa4335",
                "md5": "5447c576b188497a56ac82416da63206",
                "sha256": "c1e2801fa91cfd3da98e340a7d44e35b60bfe947d81b295f066244ab817a08d5"
            },
            "downloads": -1,
            "filename": "litestar_tailwind-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5447c576b188497a56ac82416da63206",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 8269,
            "upload_time": "2025-08-04T19:37:42",
            "upload_time_iso_8601": "2025-08-04T19:37:42.938169Z",
            "url": "https://files.pythonhosted.org/packages/e6/58/d5366908c737d0c3d9e5225be3456c4960ba691547d905e7e07537fa4335/litestar_tailwind-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b22384f92b5b31140c4d65ee59b78dbd4a144b1ed33fddd785f852749968dc85",
                "md5": "96278ef5c8f1aea7c1fc6b3e3337652a",
                "sha256": "e8c67086936f03fbded59ecb09730d588cbb1cf7d4a016085af2962a6f299818"
            },
            "downloads": -1,
            "filename": "litestar_tailwind-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "96278ef5c8f1aea7c1fc6b3e3337652a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 113357,
            "upload_time": "2025-08-04T19:37:44",
            "upload_time_iso_8601": "2025-08-04T19:37:44.217038Z",
            "url": "https://files.pythonhosted.org/packages/b2/23/84f92b5b31140c4d65ee59b78dbd4a144b1ed33fddd785f852749968dc85/litestar_tailwind-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-04 19:37:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aoi-cistus",
    "github_project": "litestar-tailwind#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "litestar-tailwind"
}
        
Elapsed time: 1.48509s