Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 3dddb75

Browse files
committed
feat(@nguniversal/common): enable inlining of critical CSS by default
1 parent 98c51a3 commit 3dddb75

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/common/engine/src/engine.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ export class CommonEngine {
5858
* render options
5959
*/
6060
async render(opts: RenderOptions): Promise<string> {
61+
const { inlineCriticalCss = true } = opts;
62+
6163
if (opts.publicPath && opts.documentFilePath && opts.url !== undefined) {
6264
const url = new URL(opts.url);
6365
// Remove leading forward slash.
@@ -94,7 +96,7 @@ export class CommonEngine {
9496
extraProviders.push({
9597
provide: INITIAL_CONFIG,
9698
useValue: {
97-
document: opts.inlineCriticalCss
99+
document: inlineCriticalCss
98100
// Workaround for https://github.com/GoogleChromeLabs/critters/issues/64
99101
? doc.replace(/ media=\"print\" onload=\"this\.media='all'"><noscript><link .+?><\/noscript>/g, '>')
100102
: doc,
@@ -107,7 +109,7 @@ export class CommonEngine {
107109
const factory = await this.getFactory(moduleOrFactory);
108110

109111
const html = await renderModuleFactory(factory, { extraProviders });
110-
if (!opts.inlineCriticalCss) {
112+
if (!inlineCriticalCss) {
111113
return html;
112114
}
113115

0 commit comments

Comments
 (0)