Home / Function/ extractUsedVariables() — tailwindcss Function Reference

extractUsedVariables() — tailwindcss Function Reference

Architecture documentation for the extractUsedVariables() function in variables.ts from the tailwindcss codebase.

Function typescript Oxide Extractor calls 2 called by 2

Entity Profile

Dependency Diagram

graph TD
  44fc256b_22c1_3ae2_924e_7d583f63c030["extractUsedVariables()"]
  1bf56ca1_f8c2_89ae_a95d_926dfbb81670["variables.ts"]
  44fc256b_22c1_3ae2_924e_7d583f63c030 -->|defined in| 1bf56ca1_f8c2_89ae_a95d_926dfbb81670
  9f2a64dc_05ff_3425_1af8_f2dbd33c3b9a["optimizeAst()"]
  9f2a64dc_05ff_3425_1af8_f2dbd33c3b9a -->|calls| 44fc256b_22c1_3ae2_924e_7d583f63c030
  e557c8a4_bb27_ee44_c462_9e238157ad04["buildDesignSystem()"]
  e557c8a4_bb27_ee44_c462_9e238157ad04 -->|calls| 44fc256b_22c1_3ae2_924e_7d583f63c030
  4982d9ce_98d4_85d9_44af_7cc47b93c482["walk()"]
  44fc256b_22c1_3ae2_924e_7d583f63c030 -->|calls| 4982d9ce_98d4_85d9_44af_7cc47b93c482
  49a8c506_c50e_ed4b_5a0e_0393edae2b6f["parse()"]
  44fc256b_22c1_3ae2_924e_7d583f63c030 -->|calls| 49a8c506_c50e_ed4b_5a0e_0393edae2b6f
  style 44fc256b_22c1_3ae2_924e_7d583f63c030 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/utils/variables.ts lines 4–18

export function extractUsedVariables(raw: string): string[] {
  let variables: string[] = []
  walk(ValueParser.parse(raw), (node) => {
    if (node.kind !== 'function' || node.value !== 'var') return

    walk(node.nodes, (child) => {
      if (child.kind !== 'word' || child.value[0] !== '-' || child.value[1] !== '-') return

      variables.push(child.value)
    })

    return WalkAction.Skip
  })
  return variables
}

Domain

Subdomains

Frequently Asked Questions

What does extractUsedVariables() do?
extractUsedVariables() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/utils/variables.ts.
Where is extractUsedVariables() defined?
extractUsedVariables() is defined in packages/tailwindcss/src/utils/variables.ts at line 4.
What does extractUsedVariables() call?
extractUsedVariables() calls 2 function(s): parse, walk.
What calls extractUsedVariables()?
extractUsedVariables() is called by 2 function(s): buildDesignSystem, optimizeAst.

Analyze Your Own Codebase

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

Try Supermodel Free