Tailwind Mail
A simple toolkit for building email templates using Tailwind CSS.
Prerequisites
- Python 3.9+
- uv - Fast Python package installer and resolver
- Task - Task runner
Getting Started
- Clone the repository:
git clone https://github.com/choinhet/tailwind-mail.git
cd tailwind-mail
- Install dependencies:
uv sync
Usage
Development Mode
To start the development server, run:
task dev
This will:
- Start the FastAPI development server at http://localhost:8000
- Watch for Tailwind CSS changes and rebuild automatically
- Live reload the preview when you make changes
Creating Your Email
Edit the template at tailwind_mail/templates/index.html.jinja
. This file supports:
- Full Tailwind CSS classes
- Jinja2 templating
- Regular HTML
Building the Final Email
To generate the final HTML with inlined styles:
task build
Or you can specify the output path:
task build -- my_custom_output.html
Alternative syntax:
task build OUTPUT=my_custom_output.html
This will generate the final HTML and save it to my_custom_output.html
.
Tips
- The development server provides a live preview that updates as you code
- All Tailwind CSS features are supported
- The final build will inline all styles, making it email-client friendly
- Copy the generated HTML file to use in your email sending system