Home / Function/ removeConflictVars() — ui Function Reference

removeConflictVars() — ui Function Reference

Architecture documentation for the removeConflictVars() function in update-css-vars.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  58e7b2ac_cad4_7633_94d8_189a236a9eac["removeConflictVars()"]
  09244f5d_7fce_b385_220b_05945bb9e93b["update-css-vars.ts"]
  58e7b2ac_cad4_7633_94d8_189a236a9eac -->|defined in| 09244f5d_7fce_b385_220b_05945bb9e93b
  be472c6f_9599_a13c_545c_918b73c2bc3a["cleanupDefaultNextStylesPlugin()"]
  be472c6f_9599_a13c_545c_918b73c2bc3a -->|calls| 58e7b2ac_cad4_7633_94d8_189a236a9eac
  style 58e7b2ac_cad4_7633_94d8_189a236a9eac fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/utils/updaters/update-css-vars.ts lines 269–288

function removeConflictVars(root: Rule | Root) {
  const rootRule = root.nodes.find(
    (node): node is Rule => node.type === "rule" && node.selector === ":root"
  )

  if (rootRule) {
    const propsToRemove = ["--background", "--foreground"]

    rootRule.nodes
      .filter(
        (node): node is postcss.Declaration =>
          node.type === "decl" && propsToRemove.includes(node.prop)
      )
      .forEach((node) => node.remove())

    if (rootRule.nodes.length === 0) {
      rootRule.remove()
    }
  }
}

Subdomains

Frequently Asked Questions

What does removeConflictVars() do?
removeConflictVars() is a function in the ui codebase, defined in packages/shadcn/src/utils/updaters/update-css-vars.ts.
Where is removeConflictVars() defined?
removeConflictVars() is defined in packages/shadcn/src/utils/updaters/update-css-vars.ts at line 269.
What calls removeConflictVars()?
removeConflictVars() is called by 1 function(s): cleanupDefaultNextStylesPlugin.

Analyze Your Own Codebase

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

Try Supermodel Free