Home / Function/ transformTailwindContent() — ui Function Reference

transformTailwindContent() — ui Function Reference

Architecture documentation for the transformTailwindContent() function in update-tailwind-content.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  f258e7e3_eb35_d03e_7b8e_d83716249f2d["transformTailwindContent()"]
  d72eaa38_229d_03b5_07e7_be0d275869a1["update-tailwind-content.ts"]
  f258e7e3_eb35_d03e_7b8e_d83716249f2d -->|defined in| d72eaa38_229d_03b5_07e7_be0d275869a1
  4f499e1d_f7cd_6cfd_c7cf_c9c5d92dc63b["updateTailwindContent()"]
  4f499e1d_f7cd_6cfd_c7cf_c9c5d92dc63b -->|calls| f258e7e3_eb35_d03e_7b8e_d83716249f2d
  012cea73_c315_5fd3_95fa_d3bcd9a30df2["addTailwindConfigContent()"]
  f258e7e3_eb35_d03e_7b8e_d83716249f2d -->|calls| 012cea73_c315_5fd3_95fa_d3bcd9a30df2
  style f258e7e3_eb35_d03e_7b8e_d83716249f2d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/utils/updaters/update-tailwind-content.ts lines 44–73

export async function transformTailwindContent(
  input: string,
  content: string[],
  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
  }

  addTailwindConfigContent(configObject, content)

  return sourceFile.getFullText()
}

Subdomains

Frequently Asked Questions

What does transformTailwindContent() do?
transformTailwindContent() is a function in the ui codebase, defined in packages/shadcn/src/utils/updaters/update-tailwind-content.ts.
Where is transformTailwindContent() defined?
transformTailwindContent() is defined in packages/shadcn/src/utils/updaters/update-tailwind-content.ts at line 44.
What does transformTailwindContent() call?
transformTailwindContent() calls 1 function(s): addTailwindConfigContent.
What calls transformTailwindContent()?
transformTailwindContent() is called by 1 function(s): updateTailwindContent.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free