Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tailwindlabs/tailwindcss/llms.txt
Use this file to discover all available pages before exploring further.
compile()
Compile a CSS string containing Tailwind directives into optimized CSS output.Parameters
The input CSS string containing Tailwind directives like
@tailwind utilities, @theme, @variant, etc.Optional compilation options
Return Value
Array of source patterns discovered from
@source directives.Root configuration extracted from
source() parameters in @tailwind utilities.Can be:null- No root specified'none'- Explicitly disabled viasource(none){ base: string; pattern: string }- Explicit pattern
Bitmask of features detected in the CSS:
Features.AtApply-@applywas usedFeatures.AtImport-@importwas usedFeatures.JsPluginCompat-@pluginor@configwas usedFeatures.ThemeFunction-theme()function was usedFeatures.Utilities-@tailwind utilitieswas usedFeatures.Variants-@variantwas usedFeatures.AtTheme-@themewas used
Function to generate CSS for a given set of candidates.Returns the compiled CSS string. Automatically caches results - if the same candidates are provided, returns the cached output without recompilation.
Function to generate a source map for the compiled CSS.
Example Usage
compileAst()
Compile a pre-parsed AST instead of a CSS string. This is useful when you already have an AST from the CSS parser.Parameters
Array of AST nodes from the CSS parser.
Same options as
compile() function. See above for details.Return Value
Returns the same structure ascompile(), except the build() function returns AstNode[] instead of a string, and there is no buildSourceMap() function.
Function to generate an AST for a given set of candidates.Returns an array of AST nodes that can be further processed or converted to CSS using
toCss().