GOTTH+
GitHub

Building

Tailwind CSS v4

The standalone Tailwind CLI, how it finds classes, and how to add your own font.

Building the CSS

There is no Node and no bundler. The Tailwind v4 standalone CLI builds static/output.css from static/input.css. make css builds it once, and make dev keeps it watching.

make css        # minified static/output.css
make dev-css    # watch mode (also run by make dev)

The production image (--docker) builds the CSS itself, with a pinned, checksum-verified Tailwind CLI, so a stale local output.css never reaches production.

Finding classes

Tailwind only generates classes it can find as complete literal strings. input.css lists the view and styles directories as sources, so a class written in a .templ file or in internal/styles is included. Never build a class by concatenation such as "bg-" + color.

Repeated class lists belong in internal/styles as functions, which keeps a component's markup short and the class strings in one place.

Fonts and focus

To self-host a font, put the .woff2 file in static/font, declare the @font-face in input.css and register it in @theme. Preload it in the layout. Don't use a third-party font CDN: the Content-Security-Policy only allows fonts from the app itself, and self-hosting keeps requests private and fast.

Keep a visible focus ring. Use the focus-visible: classes alone: adding focus:outline-none beside a focus-visible:outline-* ring hides the ring in Tailwind v4.

Was this page helpful?

Be the first to answer.