CodeVetter · Repo Unpack · Feature catalog
tailwindlabs/tailwindcss
User-facing surface is (a) the CSS authoring language — a set of at-rules parsed in `parseCss`, (b) the `tailwindcss` CLI with `build` and `canonicalize` subcommands, (c) five build-tool integrations, (d) a zero-build browser CDN script, and (e) the `@tailwindcss/upgrade` migration CLI. The compat layer additionally re-exposes the entire v3 JS plugin API (`addUtilities`, `matchVariant`, `theme()`, etc.) so existing plugins keep working. IntelliSense-facing APIs (`getClassList`, `getVariants`, `canonicalizeCandidates`) are first-class exports of the design system rather than an afterthought.
- The CSS at-rule vocabulary handled in `parseCss` is `@tailwind utilities`, `@utility`, `@source` (with `not`, `inline(…)`, and brace-expansion via `expand()`), `@variant`, `@custom-variant`, `@theme` (with `reference`/`inline`/`default`/`static`/`prefix(…)` options), `@apply`, `@import`, `@plugin`, and `@config`.
- `@import "tailwindcss" theme(reference)`, `prefix(ident)`, `important`, and `source(…)` are implemented by rewriting the `@media` node that `postcss-import`-style resolution produces — `@media theme(reference)` is transformed into a `context({ reference: true })` wrapper rather than being a distinct parser path.
- The `tailwindcss` CLI exposes `build` (default when no subcommand is given) and `canonicalize`, with root-level `--help` dispatch in `run()` that also errors on unknown non-flag commands.
- `tailwindcss build` supports `--input/-i` (including `-` for stdin), `--output/-o`, `--watch[=always]`, `--poll[=ms]`, `--minify/-m`, `--optimize`, `--cwd`, `--map`, and `--silent`; when no `--input` is given it defaults to compiling `@import 'tailwindcss';`.
- `tailwindcss canonicalize` rewrites candidate lists to their canonical form, reading from argv or stdin, with `--css` to point at a design-system entry, `--format text|json|jsonl`, and `--stream` for line-by-line stdin processing — aimed at tooling like Prettier plugins and linters.
- `@tailwindcss/vite` ships as an array of three Vite plugins — `@tailwindcss/vite:scan` (config capture), `:generate:serve` (dev), and `:generate:build` (production, which additionally runs `optimize()`) — each with `transform.filter` id include/exclude regexes that skip `?raw`, `?url`, `?worker`, and CommonJS proxy requests.
- `@tailwindcss/postcss` accepts `base`, `optimize` (defaults to `NODE_ENV === 'production'`), and `transformAssetUrls`, and bundles a `fixRelativePathsPlugin()` that repairs paths when `postcss-import` ran before it.
- `@tailwindcss/webpack` and `@tailwindcss/turbopack` are near-identical webpack `LoaderContext` loaders taking `{ base, optimize }`, both keyed into a shared `QuickLRU` cache of max size 50 via `getCacheKey(resourceId, opts)`.
- `@tailwindcss/browser` is a CDN build that reads `<style type="text/tailwindcss">` blocks, auto-injects `@import "tailwindcss";` when the user's CSS has no `@import`, and serves `tailwindcss`, `/preflight`, `/theme`, and `/utilities` from inlined `assets.css.*` strings; plugins and config files throw.
- The v3 JS plugin API is fully re-implemented in `compat/plugin-api.ts`: `addBase`, `addVariant`, `matchVariant`, `addUtilities`, `matchUtilities`, `addComponents`/`matchComponents` (which just delegate to the utility variants), and a `theme()` function built by `createThemeFn`.
- `tailwindcss` re-exports v3 compatibility entry points as separate package exports: `tailwindcss/colors`, `tailwindcss/defaultTheme`, `tailwindcss/plugin`, and `tailwindcss/lib/util/flattenColorPalette`, each with paired `.ts`/`.cts` implementations for ESM and CJS.
- `@tailwindcss/upgrade` is a standalone migration CLI (`--config`, `--force`, `--version`) that refuses to run on a dirty git tree, migrates stylesheets, migrates `tailwind.config.js` into CSS, rewrites class names in templates, and then shells out to the detected package manager to bump `tailwindcss` and friends to `@latest`.
- The Oxide scanner ships language-aware pre-processors for 14 template dialects, dispatched by file extension: Clojure, Elixir/HEEx, Razor, Haml, JSON, Markdown, Pug, Ruby/ERB, Slim, Svelte, Rust, Template Toolkit, Twig, and Vue.
- Source maps are a supported output across surfaces: the core exposes `buildSourceMap()` returning a `DecodedSourceMap`, the CLI writes it inline or to a file via `--map`, and Vite emits it when `config.css.devSourcemap` is on.