twl

The cn API with macro compilation for commented Tailwind classes and conflict merging.

What you write
What ships

Newlines and comments

Group class names the way you think about them, annotate the groups, and let the compiler fold it all into one string.

Static templates compile away

A static template becomes a string literal. A static macro template has its tailwind-merge resolved at build time too.

Compiler-only entry

The macro entry contains declarations only. The compiler removes it and imports runtime helpers from twl/runtime.

Every bundler

Vite, Rollup, Rolldown, webpack, Rspack, esbuild and Farm through unplugin — and Turbopack through its own loader.

This page is built with twl and best-i18n. Every class name on it was folded at build time, and every string above was inlined for this locale.