v1.0.16

Tailwind Middleware for Fastro

This middleware compiles Tailwind/PostCSS on the fly (in development) or serves a prebuilt CSS file in production. It exposes a simple function tailwind(pathname = "/styles.css", staticDir = "/static") that returns a middleware compatible with Fastro's middleware pipeline.

Why use it?

Quick usage

  1. Import and register the middleware in app/main.ts or your middleware stack:
import { tailwind } from "../middlewares/tailwind/tailwind.ts";

// register at the top of the stack so the CSS path is served early
app.use(tailwind('/styles.css', '/static'));
  1. Include the stylesheet in your pages:
<link rel="stylesheet" href="/styles.css">

Configuration notes

Code

Notes and tips

Examples and advanced usage