Tool to use Tailwind CSS and Daisyui in your FastHTML projects.
Project description
fh_tailwind
📖 Explore the Documentation for more examples and details!
https://fbereilh.github.io/fh_tailwind/
Key Features
⚙️ Tailwind and DaisyUI Setup 🔍 Dynamic Class Extraction 🎨 Custom Themes
🛠️ Installation
Ensure that Node.js is installed before proceeding. Install the package using pip:
$ pip install fh_tailwind
🚀 Usage
To set up Tailwind in your project, use the following command in the root of the project to initialize everything:
$ fh_tailwind_setup
This command will configure Tailwind and DaisyUI in your project, creating all necessary files and folders (public and node).
📋 Example: FastHTML with Tailwind and DaisyUI
To start using the package in your project:
from fh_tailwind import update_styles
from fasthtml.common import Link, fast_app, serve, Div, P
hdrs = [Link(rel="stylesheet", href="public/styles.css", type="text/css")]
app, rt = fast_app(
live=True, # 🔴 Enable live updates
pico=False, # 🚫 Disable PicoCSS to use Tailwind instead
on_startup=[update_styles], # 🔄 Run update_styles during startup
hdrs=hdrs,
htmlkw={"data-theme": "mytheme"},
)
@rt("/")
def get():
return Div(cls="flex items-center justify-center h-96")(
P(cls="text-6xl text-center font-bold")(
"Hello, Tailwind and DaisyUI with mytheme is applied!")
)
serve()
📋 Requirements
-
Node.js: This package depends on Node.js for installing and managing Tailwind CSS and DaisyUI.
-
Python 3.x: This script uses Python 🐍 to manage files and execute commands.
📜 License
This package is open source under the MIT License.
🤝 Contributions
Contributions are welcome! Feel free to submit a pull request 🔃 or create an issue 🐞 if you find a bug or have a feature request.
Happy coding with FastHTML and Tailwind CSS! 🎉💻 For more examples, detailed instructions, and further customization options, visit our official documentation.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file fh_tailwind-0.0.1.tar.gz
.
File metadata
- Download URL: fh_tailwind-0.0.1.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b65ca2458670089a7b7497fb2c1990c3c090dd7e0919ce33ed8f1d310515cf21 |
|
MD5 | 6e1515f66fa882871ee1b8c1523f917d |
|
BLAKE2b-256 | 66018fdc94d1003418a94a05441742e814205075eb13405523faeb52b5b19529 |
File details
Details for the file fh_tailwind-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: fh_tailwind-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | acbbaead6c0b60115774db86d371fdb631f21b9b70a397c427f0693b4ee6aaef |
|
MD5 | 0c96cdeaed753f4fab1bbbb5665f6083 |
|
BLAKE2b-256 | 8888523f2ec128a9b7a674f02d2217143331adef364f7189a46745963c59bcd9 |