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

InlineCritical CSS optimization not working in Angular Universal App using Bootstrap styles #2002

@jcrespoven

Description

@jcrespoven

🐞 Bug report

What modules are related to this issue?

  • aspnetcore-engine
  • builders
  • common
  • express-engine
  • hapi-engine

Is this a regression?

No

Description

InlineCritical optimization is not working as expected in Angular Universal applications that are using Bootstrap styles. A blink of unstyled html is shown. It seems that bootstrap styles are not inlined as critical and are being lazy loaded.

🔬 Minimal Reproduction

I have created a reproduction app where you can check the issue: test-app
It's a new application, with Angular Universal and Bootstrap dependencies added, and InlineCritical optimization enabled. I moved the AppComponent styles to the corresponding SCSS file and also added a red square div that should appear centered at the top of the screen.

If the application is served in SSR mode, you should see how the red square blinks when refreshing the page (it has no bootstrap styles until styles.xxxxxxxxx.css is loaded).


npm run build:ssr
npm run serve:ssr
http://localhost:4500

🔥 Exception or Error

No errors are shown

🌍 Your Environment


Angular CLI: 11.2.1
Node: 14.16.0
OS: win32 x64

Angular: 11.2.2
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.1
@angular-devkit/build-angular   0.1102.1
@angular-devkit/core            11.2.1
@angular-devkit/schematics      11.2.1
@angular/cli                    11.2.1
@nguniversal/builders           11.2.0
@nguniversal/express-engine     11.2.0
@schematics/angular             11.2.1
@schematics/update              0.1102.1
rxjs                            6.6.3
typescript                      4.1.5

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions