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
  4a998e90_3ddd_d06c_3938_27bd77fe05e4["asyncReplace()"]
  76fabe9d_dc97_71ec_324d_538db5f890dc["rewriteCssUrls()"]
  76fabe9d_dc97_71ec_324d_538db5f890dc -->|calls| 4a998e90_3ddd_d06c_3938_27bd77fe05e4
  3d9b4ec5_fe39_c58e_e6f0_b825053581d2["rewriteCssImageSet()"]
  3d9b4ec5_fe39_c58e_e6f0_b825053581d2 -->|calls| 4a998e90_3ddd_d06c_3938_27bd77fe05e4
  style 4a998e90_3ddd_d06c_3938_27bd77fe05e4 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.
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