Install Tailwind CSS in Python projects, no NPM required.
Project description
Tailwind-Py
Tailwind-Py is a lightweight Python utility that allows you to download and use TailwindCSS without NPM. It is designed for Python web frameworks like Flask, Django, and FastAPI, making it easy to integrate Tailwind into your projects.
Inspired from the standalone published here.
Table of Contents
Install
If you have Python 3.12+ installed, you can install tailwind-py using pip:
pip install tailwind-py
After installation, you can proceed to the usage section.
Install locally
tailwind-py uses the following pre-requisites:
- Python 3.12 or higher
- Poetry 2.1 or higher
You will then need to clone the repo and install it using Poetry:
git clone https://github.com/your-repo/tailwind-py.git
cd tailwind-py
poetry install
Check if the CLI works.
$ tailwindcss --help
usage: tailwindcss [-h] {download,init,build} ...
Tailwind Python CLI - A tool for managing Tailwind CSS in Python projects, without npm
options:
-h, --help show this help message and exit
subcommands:
{download,init,build}
Available commands
download Downloads the latest version of the TailwindCSS CLI
init Initialize `tailwind.config.js` file
build Builds the CSS output
Use 'tailwindcss <command> --help' for more information on a specific command.
Usage
Use tailwind download to download the latest version of TailwindCSS's standalone CLI, ready to use alongside this package.
Then use tailwind build -i "/path/to/your/input.css" -o "/path/to/your/output.css" --watch to start a watcher over the final result of your CSS file, named output.css. The input.css file is a file contaning directives for TailwindCSS. Here's an example:
@import "tailwindcss";
/* Your custom styles there */
For further details, check the official TailwindCSS documentation.
Commands
tailwind download: downloads the latest version of TailwindCSS's CLI on Githubtailwind init: writes in the current directory by default thetailwind.config.jsfiletailwind build: compiles an input CSS file (typically located in your static directory) into an optimized output CSS file, ready to use in your project. Use the--watchflag for active changes and the--minifyoption to produce a lightweight output.
Quickstart
After installing tailwind-py, you can quickly generate a Tailwind-powered CSS file:
tailwind download # Fetch the latest Tailwind CLI
tailwind init # Create a default tailwind.config.js (not really needed for 4.0+)
tailwind build -i "static/css/input.css" -o "static/css/output.css" --watch
Then include output.css in your project:
<link rel="stylesheet" href="static/css/output.css">
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tailwind_py-0.1.1.tar.gz.
File metadata
- Download URL: tailwind_py-0.1.1.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.11.3 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd8641271c66d7e6d070b9588ebd8defd66986b82f8d9fcd3ccaaf5959f974df
|
|
| MD5 |
fe8d33c37b2f6d675734293cc941ad34
|
|
| BLAKE2b-256 |
d30e4c31e69ec4e5c43236fdd9b3d9b0b4d768db404c594137765f60fa10d0dd
|
File details
Details for the file tailwind_py-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tailwind_py-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.11.3 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2d257ab47b0c194c68df4c271c0b0a2c49fc22decd945c22ed8c6c6a29c85a0
|
|
| MD5 |
30d1f8c84f3754f07d5499c75e6dd667
|
|
| BLAKE2b-256 |
26a6c79af1880f81ac4d5bc0ec275637513c754f2da281e3b798d55eec4c1b61
|