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 OxideEngine Scanner calls 2 called by 2

Entity Profile

Dependency Diagram

graph TD
  c74af9b2_8c4e_9508_1d10_dd910b7bf65e["extractUsedVariables()"]
  edaa1d08_cd1b_f279_0758_2debcf255efc["variables.ts"]
  c74af9b2_8c4e_9508_1d10_dd910b7bf65e -->|defined in| edaa1d08_cd1b_f279_0758_2debcf255efc
  47b4c875_7e44_6ff9_fb06_16ecf9254223["optimizeAst()"]
  47b4c875_7e44_6ff9_fb06_16ecf9254223 -->|calls| c74af9b2_8c4e_9508_1d10_dd910b7bf65e
  9b965fd7_d8e9_0b43_cd5d_c9294ab598ed["buildDesignSystem()"]
  9b965fd7_d8e9_0b43_cd5d_c9294ab598ed -->|calls| c74af9b2_8c4e_9508_1d10_dd910b7bf65e
  ed78da58_8727_ad98_120c_61f35cea357a["walk()"]
  c74af9b2_8c4e_9508_1d10_dd910b7bf65e -->|calls| ed78da58_8727_ad98_120c_61f35cea357a
  2d6c8361_96d8_df0d_ca51_c62f179fdc73["parse()"]
  c74af9b2_8c4e_9508_1d10_dd910b7bf65e -->|calls| 2d6c8361_96d8_df0d_ca51_c62f179fdc73
  style c74af9b2_8c4e_9508_1d10_dd910b7bf65e 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