MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / rewriteCssUrls

Function rewriteCssUrls

packages/cli/src/utils/publishProject.ts:230–244  ·  view source on GitHub ↗
(
  ctx: ExternalAssetContext,
  css: string,
  referrerAbsDir: string,
  entryPath: string,
)

Source from the content-addressed store, hash-verified

228}
229
230function rewriteCssUrls(
231 ctx: ExternalAssetContext,
232 css: string,
233 referrerAbsDir: string,
234 entryPath: string,
235): { css: string; modified: boolean } {
236 let modified = false;
237 const rewritten = css.replace(CSS_URL_RE, (full, quote: string, rawUrl: string) => {
238 const archivePath = tryResolveExternal(ctx, (rawUrl || "").trim(), referrerAbsDir);
239 if (!archivePath) return full;
240 modified = true;
241 return `url(${quote || ""}${posix.relative(posix.dirname(entryPath), archivePath)}${quote || ""})`;
242 });
243 return { css: rewritten, modified };
244}
245
246function rewriteHtmlAttributes(
247 ctx: ExternalAssetContext,

Callers 2

rewriteStyleBlocksFunction · 0.85
localizeCssEntryFunction · 0.85

Calls 1

tryResolveExternalFunction · 0.85

Tested by

no test coverage detected