Home / Function/ asyncReplace() — tailwindcss Function Reference

asyncReplace() — tailwindcss Function Reference

Architecture documentation for the asyncReplace() function in urls.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  92702d59_0bcf_9750_7f78_111b68ea9c52["asyncReplace()"]
  95a806ab_8556_4112_9786_fda4ff23eeca["urls.ts"]
  92702d59_0bcf_9750_7f78_111b68ea9c52 -->|defined in| 95a806ab_8556_4112_9786_fda4ff23eeca
  36fca4a6_2f8c_515f_e349_2ce4e1dac4c7["rewriteCssUrls()"]
  36fca4a6_2f8c_515f_e349_2ce4e1dac4c7 -->|calls| 92702d59_0bcf_9750_7f78_111b68ea9c52
  ea271be7_d34b_5dc2_9aad_c5fa1b0713cb["rewriteCssImageSet()"]
  ea271be7_d34b_5dc2_9aad_c5fa1b0713cb -->|calls| 92702d59_0bcf_9750_7f78_111b68ea9c52
  style 92702d59_0bcf_9750_7f78_111b68ea9c52 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-node/src/urls.ts lines 192–207

async function asyncReplace(
  input: string,
  re: RegExp,
  replacer: (match: RegExpExecArray) => string | Promise<string>,
): Promise<string> {
  let match: RegExpExecArray | null
  let remaining = input
  let rewritten = ''
  while ((match = re.exec(remaining))) {
    rewritten += remaining.slice(0, match.index)
    rewritten += await replacer(match)
    remaining = remaining.slice(match.index + match[0].length)
  }
  rewritten += remaining
  return rewritten
}

Domain

Subdomains

Frequently Asked Questions

What does asyncReplace() do?
asyncReplace() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-node/src/urls.ts.
Where is asyncReplace() defined?
asyncReplace() is defined in packages/@tailwindcss-node/src/urls.ts at line 192.
What calls asyncReplace()?
asyncReplace() is called by 2 function(s): rewriteCssImageSet, rewriteCssUrls.

Analyze Your Own Codebase

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

Try Supermodel Free