Skip to content
Latchkey

tailwindcss -i -o --minify: Build Utility CSS

tailwindcss -i input.css -o output.css --minify compiles Tailwind, tree-shaking to only the utilities your content uses, and minifies the result.

The Tailwind CLI turns directives into real CSS by scanning your templates. In CI, the content globs decide which classes survive, so getting them right is the whole game.

What it does

The tailwindcss CLI reads an input CSS with @tailwind/@import directives, scans the configured content files for class names, generates only the utilities actually used, and writes the output. --minify compresses it for production.

Common usage

Terminal
tailwindcss -i src/input.css -o dist/output.css --minify
# override content globs from the CLI
tailwindcss -i src/input.css -o dist/output.css \
  --content "./src/**/*.{html,js,ts,jsx,tsx}" --minify

Options

FlagWhat it does
-i <file>Input CSS containing Tailwind directives
-o <file>Output CSS file
--minifyMinify the generated CSS
--content <glob>Files to scan for class names
-c, --config <file>Tailwind config file
-w, --watchWatch mode (not for CI)

In CI

The output only contains classes found in the scanned content, so if the content globs miss your templates the production CSS ships nearly empty and the site looks unstyled. Verify the content paths match where files actually live on the runner (case-sensitive on Linux).

Common errors in CI

"warn - The content option in your Tailwind CSS configuration is missing or empty" and "No utility classes were detected in your source files" mean the content globs match nothing, producing empty CSS. A styled local build with an unstyled CI build almost always traces to content paths that only match on a case-insensitive filesystem.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →