Home / Function/ substituteFunctions() — tailwindcss Function Reference

substituteFunctions() — tailwindcss Function Reference

Architecture documentation for the substituteFunctions() function in css-functions.ts from the tailwindcss codebase.

Function typescript OxideCore Extractor calls 2 called by 3

Entity Profile

Dependency Diagram

graph TD
  6896eab3_60a4_7b0f_937b_8de4f4e9fe5a["substituteFunctions()"]
  3b6a2079_7f12_42cd_ba9f_a57ecec4366d["buildPluginApi()"]
  3b6a2079_7f12_42cd_ba9f_a57ecec4366d -->|calls| 6896eab3_60a4_7b0f_937b_8de4f4e9fe5a
  c58d3214_88d6_f4fc_257f_8e84def5b24f["buildDesignSystem()"]
  c58d3214_88d6_f4fc_257f_8e84def5b24f -->|calls| 6896eab3_60a4_7b0f_937b_8de4f4e9fe5a
  95cb326e_6b59_0903_0c96_d221fca5c2b1["parseCss()"]
  95cb326e_6b59_0903_0c96_d221fca5c2b1 -->|calls| 6896eab3_60a4_7b0f_937b_8de4f4e9fe5a
  a32bba76_f60d_883f_1ff1_276a0bb9db9f["walk()"]
  6896eab3_60a4_7b0f_937b_8de4f4e9fe5a -->|calls| a32bba76_f60d_883f_1ff1_276a0bb9db9f
  5f56996c_e87d_a997_67df_2ad202639ad3["substituteFunctionsInValue()"]
  6896eab3_60a4_7b0f_937b_8de4f4e9fe5a -->|calls| 5f56996c_e87d_a997_67df_2ad202639ad3
  style 6896eab3_60a4_7b0f_937b_8de4f4e9fe5a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/css-functions.ts lines 158–183

export function substituteFunctions(ast: AstNode[], designSystem: DesignSystem) {
  let features = Features.None
  walk(ast, (node) => {
    // Find all declaration values
    if (node.kind === 'declaration' && node.value && THEME_FUNCTION_INVOCATION.test(node.value)) {
      features |= Features.ThemeFunction
      node.value = substituteFunctionsInValue(node.value, node, designSystem)
      return
    }

    // Find at-rules rules
    if (node.kind === 'at-rule') {
      if (
        (node.name === '@media' ||
          node.name === '@custom-media' ||
          node.name === '@container' ||
          node.name === '@supports') &&
        THEME_FUNCTION_INVOCATION.test(node.params)
      ) {
        features |= Features.ThemeFunction
        node.params = substituteFunctionsInValue(node.params, node, designSystem)
      }
    }
  })
  return features
}

Domain

Subdomains

Frequently Asked Questions

What does substituteFunctions() do?
substituteFunctions() is a function in the tailwindcss codebase.
What does substituteFunctions() call?
substituteFunctions() calls 2 function(s): substituteFunctionsInValue, walk.
What calls substituteFunctions()?
substituteFunctions() is called by 3 function(s): buildDesignSystem, buildPluginApi, parseCss.

Analyze Your Own Codebase

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

Try Supermodel Free