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
  5024843c_0895_bb5b_d92c_9fd3fe31902d["asyncReplace()"]
  e196e78f_ee26_e71e_f9e6_b41f9d8c8b40["rewriteCssUrls()"]
  e196e78f_ee26_e71e_f9e6_b41f9d8c8b40 -->|calls| 5024843c_0895_bb5b_d92c_9fd3fe31902d
  03f31b9c_dbf2_bdf2_18d8_8b2958a2a30d["rewriteCssImageSet()"]
  03f31b9c_dbf2_bdf2_18d8_8b2958a2a30d -->|calls| 5024843c_0895_bb5b_d92c_9fd3fe31902d
  style 5024843c_0895_bb5b_d92c_9fd3fe31902d 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
}

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