Home / Function/ injectFallbackForInitialFallback() — tailwindcss Function Reference

injectFallbackForInitialFallback() — tailwindcss Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  c85d11ae_ab39_c633_47f6_6b20e6acd2dc["injectFallbackForInitialFallback()"]
  552e707a_ccba_b2a6_5917_15f7a417896b["theme()"]
  552e707a_ccba_b2a6_5917_15f7a417896b -->|calls| c85d11ae_ab39_c633_47f6_6b20e6acd2dc
  e9d556bc_f22d_356c_1bd2_27442c34b5c7["walk()"]
  c85d11ae_ab39_c633_47f6_6b20e6acd2dc -->|calls| e9d556bc_f22d_356c_1bd2_27442c34b5c7
  style c85d11ae_ab39_c633_47f6_6b20e6acd2dc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/css-functions.ts lines 226–243

function injectFallbackForInitialFallback(ast: ValueParser.ValueAstNode[], fallback: string): void {
  walk(ast, (node) => {
    if (node.kind !== 'function') return
    if (node.value !== 'var' && node.value !== 'theme' && node.value !== '--theme') return

    if (node.nodes.length === 1) {
      node.nodes.push({
        kind: 'word',
        value: `, ${fallback}`,
      })
    } else {
      let lastNode = node.nodes[node.nodes.length - 1]
      if (lastNode.kind === 'word' && lastNode.value === 'initial') {
        lastNode.value = fallback
      }
    }
  })
}

Subdomains

Calls

Called By

Frequently Asked Questions

What does injectFallbackForInitialFallback() do?
injectFallbackForInitialFallback() is a function in the tailwindcss codebase.
What does injectFallbackForInitialFallback() call?
injectFallbackForInitialFallback() calls 1 function(s): walk.
What calls injectFallbackForInitialFallback()?
injectFallbackForInitialFallback() is called by 1 function(s): theme.

Analyze Your Own Codebase

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

Try Supermodel Free