extractConfigs() — tailwindcss Function Reference
Architecture documentation for the extractConfigs() function in resolve-config.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 05889969_ebc3_9d51_d4b2_d691a9fd846a["extractConfigs()"] 9b5d2e3d_392e_c654_c350_1352ed70f5e8["resolve-config.ts"] 05889969_ebc3_9d51_d4b2_d691a9fd846a -->|defined in| 9b5d2e3d_392e_c654_c350_1352ed70f5e8 0ed24ba5_7c39_3f5a_fdbb_f973a617a172["resolveConfig()"] 0ed24ba5_7c39_3f5a_fdbb_f973a617a172 -->|calls| 05889969_ebc3_9d51_d4b2_d691a9fd846a style 05889969_ebc3_9d51_d4b2_d691a9fd846a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/tailwindcss/src/compat/config/resolve-config.ts lines 135–196
function extractConfigs(
ctx: ResolutionContext,
{ config, base, path, reference, src }: ConfigFile,
): void {
let plugins: PluginWithConfig[] = []
// Normalize plugins so they share the same shape
for (let plugin of config.plugins ?? []) {
if ('__isOptionsFunction' in plugin) {
// Happens with `plugin.withOptions()` when no options were passed:
// e.g. `require("my-plugin")` instead of `require("my-plugin")(options)`
plugins.push({ ...plugin(), reference, src })
} else if ('handler' in plugin) {
// Happens with `plugin(…)`:
// e.g. `require("my-plugin")`
//
// or with `plugin.withOptions()` when the user passed options:
// e.g. `require("my-plugin")(options)`
plugins.push({ ...plugin, reference, src })
} else {
// Just a plain function without using the plugin(…) API
plugins.push({ handler: plugin, reference, src })
}
}
// Apply configs from presets
if (Array.isArray(config.presets) && config.presets.length === 0) {
throw new Error(
'Error in the config file/plugin/preset. An empty preset (`preset: []`) is not currently supported.',
)
}
for (let preset of config.presets ?? []) {
extractConfigs(ctx, { path, base, config: preset, reference, src })
}
// Apply configs from plugins
for (let plugin of plugins) {
ctx.plugins.push(plugin)
if (plugin.config) {
extractConfigs(ctx, {
path,
base,
config: plugin.config,
reference: !!plugin.reference,
src: plugin.src ?? src,
})
}
}
// Merge in content paths from multiple configs
let content = config.content ?? []
let files = Array.isArray(content) ? content : content.files
for (let file of files) {
ctx.content.files.push(typeof file === 'object' ? file : { base, pattern: file })
}
// Then apply the "user" config
ctx.configs.push(config)
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does extractConfigs() do?
extractConfigs() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/compat/config/resolve-config.ts.
Where is extractConfigs() defined?
extractConfigs() is defined in packages/tailwindcss/src/compat/config/resolve-config.ts at line 135.
What calls extractConfigs()?
extractConfigs() is called by 1 function(s): resolveConfig.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free