Home / Function/ isVariableUsed() — tailwindcss Function Reference

isVariableUsed() — tailwindcss Function Reference

Architecture documentation for the isVariableUsed() function in ast.ts from the tailwindcss codebase.

Function typescript NodeBridge Compiler calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  f6e5c34f_5fff_b7c4_6b4e_54ead4f7899e["isVariableUsed()"]
  42640952_ea63_55f1_1ff1_00816e2980ae["ast.ts"]
  f6e5c34f_5fff_b7c4_6b4e_54ead4f7899e -->|defined in| 42640952_ea63_55f1_1ff1_00816e2980ae
  47b4c875_7e44_6ff9_fb06_16ecf9254223["optimizeAst()"]
  47b4c875_7e44_6ff9_fb06_16ecf9254223 -->|calls| f6e5c34f_5fff_b7c4_6b4e_54ead4f7899e
  06ed9408_12cf_7ddd_a435_8cdd942de1d4["add()"]
  f6e5c34f_5fff_b7c4_6b4e_54ead4f7899e -->|calls| 06ed9408_12cf_7ddd_a435_8cdd942de1d4
  dbf6b411_7522_4e41_ab49_f4e9c07a4751["getOptions()"]
  f6e5c34f_5fff_b7c4_6b4e_54ead4f7899e -->|calls| dbf6b411_7522_4e41_ab49_f4e9c07a4751
  5bcf4886_1230_a8ff_7302_a26cc5a9a525["get()"]
  f6e5c34f_5fff_b7c4_6b4e_54ead4f7899e -->|calls| 5bcf4886_1230_a8ff_7302_a26cc5a9a525
  style f6e5c34f_5fff_b7c4_6b4e_54ead4f7899e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/ast.ts lines 903–929

function isVariableUsed(
  variable: string,
  theme: Theme,
  variableDependencies: Map<string, Set<string>>,
  alreadySeenVariables: Set<string> = new Set(),
): boolean {
  // Break recursions when visiting a variable twice
  if (alreadySeenVariables.has(variable)) {
    return true
  } else {
    alreadySeenVariables.add(variable)
  }

  let options = theme.getOptions(variable)
  if (options & (ThemeOptions.STATIC | ThemeOptions.USED)) {
    return true
  } else {
    let dependencies = variableDependencies.get(variable) ?? []
    for (let dependency of dependencies) {
      if (isVariableUsed(dependency, theme, variableDependencies, alreadySeenVariables)) {
        return true
      }
    }
  }

  return false
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does isVariableUsed() do?
isVariableUsed() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/ast.ts.
Where is isVariableUsed() defined?
isVariableUsed() is defined in packages/tailwindcss/src/ast.ts at line 903.
What does isVariableUsed() call?
isVariableUsed() calls 3 function(s): add, get, getOptions.
What calls isVariableUsed()?
isVariableUsed() is called by 1 function(s): optimizeAst.

Analyze Your Own Codebase

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

Try Supermodel Free