Menu

Tailwind CSS and HTMX with FastAPI and Jinja, without Node.js
📰

Tailwind CSS and HTMX with FastAPI and Jinja, without Node.js

DEV Community: fastapi·patrykkomow12·17 days ago
#KuoC6Pmk
#devtofastapi#devto#dev#status#htmx
Reading 0:00
15s threshold

A modern-looking frontend for a FastAPI app, with no JavaScript build pipeline: Tailwind 4 installed with pip, one vendored HTMX file, and Jinja templates. Everything a Python developer can change without learning npm.

Tailwind without Node: the standalone CLI

Tailwind ships a standalone CLI: a single binary with Tailwind and its dependencies built in. You don't need Node.js to run it. The pytailwindcss package downloads that binary for you, so it installs like any other dev dependency:

# pyproject.toml [ project . optional - dependencies ] dev = [ " pytest>=8.3 " , " pytest-asyncio>=0.24 " , " ruff>=0.8 " , " pytailwindcss>=0.2 " , ]

Enter fullscreen mode

Exit fullscreen mode

The first time you run tailwindcss , the package downloads the binary for your platform. Pin the version, or two machines can download two different Tailwinds and produce two different CSS files.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.