Home / Function/ recursivelyEscapeUnderscores() — tailwindcss Function Reference

recursivelyEscapeUnderscores() — tailwindcss Function Reference

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

Function typescript Oxide PreProcessors calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  6ed70775_e947_c74d_9604_e478b2ca9982["recursivelyEscapeUnderscores()"]
  ba6fca27_7720_5839_0f92_bc2abb8db636["candidate.ts"]
  6ed70775_e947_c74d_9604_e478b2ca9982 -->|defined in| ba6fca27_7720_5839_0f92_bc2abb8db636
  fa7106d0_b629_ab06_9635_b04e9e0c20f0["printArbitraryValueCache()"]
  fa7106d0_b629_ab06_9635_b04e9e0c20f0 -->|calls| 6ed70775_e947_c74d_9604_e478b2ca9982
  8a1efc4f_7d6e_db3f_8e52_b25e12f7293a["escapeUnderscore()"]
  6ed70775_e947_c74d_9604_e478b2ca9982 -->|calls| 8a1efc4f_7d6e_db3f_8e52_b25e12f7293a
  4f9d9fc2_45b7_9326_3ba0_f8f40d302381["never()"]
  6ed70775_e947_c74d_9604_e478b2ca9982 -->|calls| 4f9d9fc2_45b7_9326_3ba0_f8f40d302381
  style 6ed70775_e947_c74d_9604_e478b2ca9982 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