Home / Function/ recursivelyEscapeUnderscores() — tailwindcss Function Reference

recursivelyEscapeUnderscores() — tailwindcss Function Reference

Architecture documentation for the recursivelyEscapeUnderscores() function in candidate.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  90af3061_98c6_bbc0_b56e_ef2a73fdc21a["recursivelyEscapeUnderscores()"]
  669e6a28_c71f_3c5e_9c53_915cede7da78["candidate.ts"]
  90af3061_98c6_bbc0_b56e_ef2a73fdc21a -->|defined in| 669e6a28_c71f_3c5e_9c53_915cede7da78
  f9a17feb_4681_8aa1_f2b8_21e3641747be["printArbitraryValueCache()"]
  f9a17feb_4681_8aa1_f2b8_21e3641747be -->|calls| 90af3061_98c6_bbc0_b56e_ef2a73fdc21a
  3c88f31d_8ac6_8ee3_8146_bfeefdb73288["escapeUnderscore()"]
  90af3061_98c6_bbc0_b56e_ef2a73fdc21a -->|calls| 3c88f31d_8ac6_8ee3_8146_bfeefdb73288
  4db2d742_bd4a_b2c3_a087_2fc273e1907e["never()"]
  90af3061_98c6_bbc0_b56e_ef2a73fdc21a -->|calls| 4db2d742_bd4a_b2c3_a087_2fc273e1907e
  style 90af3061_98c6_bbc0_b56e_ef2a73fdc21a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/candidate.ts lines 1118–1160

function recursivelyEscapeUnderscores(ast: ValueParser.ValueAstNode[]) {
  for (let node of ast) {
    switch (node.kind) {
      case 'function': {
        if (node.value === 'url' || node.value.endsWith('_url')) {
          // Don't decode underscores in url() but do decode the function name
          node.value = escapeUnderscore(node.value)
          break
        }

        if (
          node.value === 'var' ||
          node.value.endsWith('_var') ||
          node.value === 'theme' ||
          node.value.endsWith('_theme')
        ) {
          node.value = escapeUnderscore(node.value)
          for (let i = 0; i < node.nodes.length; i++) {
            recursivelyEscapeUnderscores([node.nodes[i]])
          }
          break
        }

        node.value = escapeUnderscore(node.value)
        recursivelyEscapeUnderscores(node.nodes)
        break
      }
      case 'separator':
        node.value = escapeUnderscore(node.value)
        break
      case 'word': {
        // Dashed idents and variables `var(--my-var)` and `--my-var` should not
        // have underscores escaped
        if (node.value[0] !== '-' || node.value[1] !== '-') {
          node.value = escapeUnderscore(node.value)
        }
        break
      }
      default:
        never(node)
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does recursivelyEscapeUnderscores() do?
recursivelyEscapeUnderscores() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/candidate.ts.
Where is recursivelyEscapeUnderscores() defined?
recursivelyEscapeUnderscores() is defined in packages/tailwindcss/src/candidate.ts at line 1118.
What does recursivelyEscapeUnderscores() call?
recursivelyEscapeUnderscores() calls 2 function(s): escapeUnderscore, never.
What calls recursivelyEscapeUnderscores()?
recursivelyEscapeUnderscores() is called by 1 function(s): printArbitraryValueCache.

Analyze Your Own Codebase

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

Try Supermodel Free