addTailwindConfigContent() — ui Function Reference
Architecture documentation for the addTailwindConfigContent() function in update-tailwind-content.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 012cea73_c315_5fd3_95fa_d3bcd9a30df2["addTailwindConfigContent()"] d72eaa38_229d_03b5_07e7_be0d275869a1["update-tailwind-content.ts"] 012cea73_c315_5fd3_95fa_d3bcd9a30df2 -->|defined in| d72eaa38_229d_03b5_07e7_be0d275869a1 f258e7e3_eb35_d03e_7b8e_d83716249f2d["transformTailwindContent()"] f258e7e3_eb35_d03e_7b8e_d83716249f2d -->|calls| 012cea73_c315_5fd3_95fa_d3bcd9a30df2 style 012cea73_c315_5fd3_95fa_d3bcd9a30df2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shadcn/src/utils/updaters/update-tailwind-content.ts lines 75–121
async function addTailwindConfigContent(
configObject: ObjectLiteralExpression,
content: string[]
) {
const quoteChar = _getQuoteChar(configObject)
const existingProperty = configObject.getProperty("content")
if (!existingProperty) {
const newProperty = {
name: "content",
initializer: `[${quoteChar}${content.join(
`${quoteChar}, ${quoteChar}`
)}${quoteChar}]`,
}
configObject.addPropertyAssignment(newProperty)
return configObject
}
if (existingProperty.isKind(SyntaxKind.PropertyAssignment)) {
const initializer = existingProperty.getInitializer()
// If property is an array, append.
if (initializer?.isKind(SyntaxKind.ArrayLiteralExpression)) {
for (const contentItem of content) {
const newValue = `${quoteChar}${contentItem}${quoteChar}`
// Check if the array already contains the value.
if (
initializer
.getElements()
.map((element) => element.getText())
.includes(newValue)
) {
continue
}
initializer.addElement(newValue)
}
}
return configObject
}
return configObject
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does addTailwindConfigContent() do?
addTailwindConfigContent() is a function in the ui codebase, defined in packages/shadcn/src/utils/updaters/update-tailwind-content.ts.
Where is addTailwindConfigContent() defined?
addTailwindConfigContent() is defined in packages/shadcn/src/utils/updaters/update-tailwind-content.ts at line 75.
What calls addTailwindConfigContent()?
addTailwindConfigContent() is called by 1 function(s): transformTailwindContent.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free