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

Entity Profile

Dependency Diagram

graph TD
  6bed2e43_7855_2758_8396_9f9e9a11be52["substituteFunctions()"]
  1648a493_13b2_8170_f86b_607e088d9565["css-functions.ts"]
  6bed2e43_7855_2758_8396_9f9e9a11be52 -->|defined in| 1648a493_13b2_8170_f86b_607e088d9565
  31653e23_464a_3652_4a48_0c82332a92c4["buildPluginApi()"]
  31653e23_464a_3652_4a48_0c82332a92c4 -->|calls| 6bed2e43_7855_2758_8396_9f9e9a11be52
  e557c8a4_bb27_ee44_c462_9e238157ad04["buildDesignSystem()"]
  e557c8a4_bb27_ee44_c462_9e238157ad04 -->|calls| 6bed2e43_7855_2758_8396_9f9e9a11be52
  f7f9b3da_5977_1aa6_3bcb_bfc607af4e8f["parseCss()"]
  f7f9b3da_5977_1aa6_3bcb_bfc607af4e8f -->|calls| 6bed2e43_7855_2758_8396_9f9e9a11be52
  4982d9ce_98d4_85d9_44af_7cc47b93c482["walk()"]
  6bed2e43_7855_2758_8396_9f9e9a11be52 -->|calls| 4982d9ce_98d4_85d9_44af_7cc47b93c482
  3c4ab5c3_3962_aeae_cc7c_5edb9e72bc85["substituteFunctionsInValue()"]
  6bed2e43_7855_2758_8396_9f9e9a11be52 -->|calls| 3c4ab5c3_3962_aeae_cc7c_5edb9e72bc85
  style 6bed2e43_7855_2758_8396_9f9e9a11be52 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, defined in packages/tailwindcss/src/css-functions.ts.
Where is substituteFunctions() defined?
substituteFunctions() is defined in packages/tailwindcss/src/css-functions.ts at line 158.
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