transformTailwindConfig() — ui Function Reference
Architecture documentation for the transformTailwindConfig() function in update-tailwind-config.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD bcd6344c_3146_377d_9fd0_f68ae594bdfb["transformTailwindConfig()"] ef3e192c_eced_bc46_1021_689faf6b7065["update-tailwind-config.ts"] bcd6344c_3146_377d_9fd0_f68ae594bdfb -->|defined in| ef3e192c_eced_bc46_1021_689faf6b7065 2f113fcc_bc61_9471_0574_77b7585effdc["updateTailwindConfig()"] 2f113fcc_bc61_9471_0574_77b7585effdc -->|calls| bcd6344c_3146_377d_9fd0_f68ae594bdfb 54febefd_ee20_a17f_1f9e_12babcc8092a["_createSourceFile()"] bcd6344c_3146_377d_9fd0_f68ae594bdfb -->|calls| 54febefd_ee20_a17f_1f9e_12babcc8092a 51327a99_70d6_a106_2e8a_4d4b8378e9f4["_getQuoteChar()"] bcd6344c_3146_377d_9fd0_f68ae594bdfb -->|calls| 51327a99_70d6_a106_2e8a_4d4b8378e9f4 8c513282_9511_c3df_77df_ed2abc37385a["addTailwindConfigProperty()"] bcd6344c_3146_377d_9fd0_f68ae594bdfb -->|calls| 8c513282_9511_c3df_77df_ed2abc37385a b5f29e14_1126_19c7_8749_e1c8e96e8227["addTailwindConfigPlugin()"] bcd6344c_3146_377d_9fd0_f68ae594bdfb -->|calls| b5f29e14_1126_19c7_8749_e1c8e96e8227 c25108fa_c2e6_295b_b5ed_e67e55e05d20["addTailwindConfigTheme()"] bcd6344c_3146_377d_9fd0_f68ae594bdfb -->|calls| c25108fa_c2e6_295b_b5ed_e67e55e05d20 style bcd6344c_3146_377d_9fd0_f68ae594bdfb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shadcn/src/utils/updaters/update-tailwind-config.ts lines 73–122
export async function transformTailwindConfig(
input: string,
tailwindConfig: UpdaterTailwindConfig,
config: Config
) {
const sourceFile = await _createSourceFile(input, config)
// Find the object with content property.
// This is faster than traversing the default export.
// TODO: maybe we do need to traverse the default export?
const configObject = sourceFile
.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression)
.find((node) =>
node
.getProperties()
.some(
(property) =>
property.isKind(SyntaxKind.PropertyAssignment) &&
property.getName() === "content"
)
)
// We couldn't find the config object, so we return the input as is.
if (!configObject) {
return input
}
const quoteChar = _getQuoteChar(configObject)
// Add darkMode.
addTailwindConfigProperty(
configObject,
{
name: "darkMode",
value: "class",
},
{ quoteChar }
)
// Add Tailwind config plugins.
tailwindConfig.plugins?.forEach((plugin) => {
addTailwindConfigPlugin(configObject, plugin)
})
// Add Tailwind config theme.
if (tailwindConfig.theme) {
await addTailwindConfigTheme(configObject, tailwindConfig.theme)
}
return sourceFile.getFullText()
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does transformTailwindConfig() do?
transformTailwindConfig() is a function in the ui codebase, defined in packages/shadcn/src/utils/updaters/update-tailwind-config.ts.
Where is transformTailwindConfig() defined?
transformTailwindConfig() is defined in packages/shadcn/src/utils/updaters/update-tailwind-config.ts at line 73.
What does transformTailwindConfig() call?
transformTailwindConfig() calls 5 function(s): _createSourceFile, _getQuoteChar, addTailwindConfigPlugin, addTailwindConfigProperty, addTailwindConfigTheme.
What calls transformTailwindConfig()?
transformTailwindConfig() is called by 1 function(s): updateTailwindConfig.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free