Skip to content

Commit

Permalink
feat(@nguniversal/common): disable critical CSS inlining by default
Browse files Browse the repository at this point in the history
With this change we disable critical css inline by default. The main motivations are the following issues angular/angular-cli#20760 and angular/angular-cli#20864.

BREAKING CHANGE:

Inlining of critical CSS is no longer enable by default. Users already on Angular version 12 and have not opted-out from using this feature are encouraged to opt-in using the `inlineCriticalCss` option.

The motivation behind this change is that the package used to parse the CSS has a number of defects which can lead to unactionable error messages when updating to Angular 13 from versions priors to 12. Such errors can be seen in the following issue angular/angular-cli#20760.
  • Loading branch information
alan-agius4 committed Oct 6, 2021
1 parent 838e478 commit 357411d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/common/clover/server/src/server-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class Engine {
pathname,
options.htmlFilename,
);
const inlineCriticalCss = options.inlineCriticalCss !== false;
const inlineCriticalCss = options.inlineCriticalCss === true;

const customResourceLoader = new CustomResourceLoader(
origin,
Expand Down
4 changes: 2 additions & 2 deletions modules/common/engine/src/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface RenderOptions {
documentFilePath?: string;
/**
* Reduce render blocking requests by inlining critical CSS.
* Defaults to true.
* Defaults to false.
*/
inlineCriticalCss?: boolean;
/**
Expand Down Expand Up @@ -64,7 +64,7 @@ export class CommonEngine {
* render options
*/
async render(opts: RenderOptions): Promise<string> {
const { inlineCriticalCss = true } = opts;
const { inlineCriticalCss = false } = opts;

if (opts.publicPath && opts.documentFilePath && opts.url !== undefined) {
const url = new URL(opts.url);
Expand Down

0 comments on commit 357411d

Please sign in to comment.