Source boundaries
Include or exclude source files while preserving each stylesheet’s path base.
Integrations and CLI flows scan ordinary project sources with defaults. Use @source directives only when the stylesheet needs an explicit source exception, such as external content, shared workspace source, or a scoped source set for explicitly enabled native CSS pruning.
@source
Adds files that may contain classes to the stylesheet source set.
@source "../content/**/*.mdx";@source not
Removes files from the stylesheet source set.
@source not "../content/drafts/**";Multiple source directives are evaluated as one include set minus one exclude set:
includes = A ∪ B ∪ Cexcludes = X ∪ Ysource set = includes − excludesFor example, these directives scan content files and a shared UI package, then remove draft content and Storybook files:
@source "../content/**/*.mdx";@source "../packages/ui/**/*.{ts,tsx}";@source not "../content/drafts/**";@source not "../packages/ui/**/*.stories.tsx";Bare source globs are resolved from the scanner cwd. Globs that start with ./ or ../ are resolved relative to the CSS file that declares the directive. These resolution rules apply on Windows and POSIX hosts; Windows filesystem path prefixes do not act as glob wildcards.
An imported CSS file keeps its own directory as the base for relative source
patterns. Files loaded only through @reference do not add scanning sources.
Scanning directives are consumed in the file that declares them, before import layers or media conditions wrap the native CSS. They do not appear in the generated stylesheet, and their relative paths still use the declaring file.
For the scanning model, see Scanning latent classes.