Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fh_tailwind-0.0.2.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

fh_tailwind-0.0.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file fh_tailwind-0.0.2.tar.gz.

File metadata

  • Download URL: fh_tailwind-0.0.2.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for fh_tailwind-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5d0127b694f2bb6ad0eecdf99cea0f67ef1e1a06a6f708a16510cc4525c31c26
MD5 6ca19063e72608752c83c45db271e0a5
BLAKE2b-256 ddf891028c5ff84f9aee27d0a2feab348e7e6c7746a3575fb716902dbb5e77e2

See more details on using hashes here.

File details

Details for the file fh_tailwind-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: fh_tailwind-0.0.2-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

Hashes for fh_tailwind-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9f187cc3f3f0f136c230b6d1e8584824cec86bc45cf3b7f73857610a9de18870
MD5 6394e0ac1113445207b39b380f8d11d9
BLAKE2b-256 1544173c07a42172899290562ce93d5390fd51783b52175c595f9a4e233f19da

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page