MCPcopy Index your code
hub / github.com/angular/angular-cli / inlineCriticalCss

Method inlineCriticalCss

packages/angular/ssr/src/app.ts:386–401  ·  view source on GitHub ↗

* Inlines critical CSS into the given HTML content. * * @param html The HTML content to process. * @param url The URL associated with the request, for logging purposes. * @returns A promise that resolves to the HTML with inlined critical CSS.

(html: string, url: URL)

Source from the content-addressed store, hash-verified

384 * @returns A promise that resolves to the HTML with inlined critical CSS.
385 */
386 private async inlineCriticalCss(html: string, url: URL): Promise<string> {
387 const { inlineCriticalCssProcessor } = this;
388
389 if (!inlineCriticalCssProcessor) {
390 return html;
391 }
392
393 try {
394 return await inlineCriticalCssProcessor.process(html);
395 } catch (error) {
396 // eslint-disable-next-line no-console
397 console.error(`An error occurred while inlining critical CSS for: ${url}.`, error);
398
399 return html;
400 }
401 }
402
403 /**
404 * Inlines critical CSS into the given HTML content.

Callers 2

handleRenderingMethod · 0.95

Calls 2

errorMethod · 0.65
processMethod · 0.45

Tested by

no test coverage detected