Skip to main content

Plugin options

Every option both tailess build plugins accept — content, ignore, extensions and cacheDir — with defaults and monorepo notes.

The options

Both plugins take the same options — cacheDir is the one exception, and it applies to PostCSS only. Every option is optional; the one-line setup covers the ordinary project.

Options
tailess({  content: ["src", "../ui/src"],   // files or dirs to scan  ignore: ["fixtures"],            // extra dir names to skip  extensions: ["tsx", "vue"],      // replaces the default list  cacheDir: "node_modules/.cache", // PostCSS only});

ignore and extensions differ in how they combine with the built-in values: extra ignore entries are added to the built-in list, while extensions replaces the default list outright.

Defaults

Default value for each tailess plugin option
OptionDefault
contentVite's root / process.cwd()
ignoreadded on top of the built-in list
extensionstsx ts mts cts jsx js mjs cjs mdx md html vue svelte astro
cacheDirnode_modules/.cache (Vite uses its own cacheDir)

Path resolution

On Vite, a relative content path resolves against Vite's root — not the directory you happened to run the command from — so vite build apps/web and monorepo task runners behave the same as a plain vite build.

On PostCSS there is no root, so paths resolve against the working directory instead. The same relative content entry can therefore point at a different directory depending on which plugin is doing the scanning.

A content that matches nothing warns

A content that matches no files warns, rather than quietly producing a stylesheet with nothing in it.

What is scanned

By default the whole project is scanned, skipping dependencies, caches and build output — dist, build, .next, .output and the like.

Dot-directories are not skipped wholesale, so .storybook/preview.tsx is still found. For what the scanner can read inside those files, see the scanner.