You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(@angular-devkit/build-angular): enable inlining of critical CSS optimizations
This is another feature that we mentioned in the Eliminate Render Blocking Requests RFC (#18730)
Inlining of critical CSS is turned off by default. To opt-in this feature set `inlineCritical` to `true`.
Example:
```json
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": {
"styles": {
"minify": true,
"inlineCritical": true,
}
},
```
To learn more about critical CSS see;
https://web.dev/defer-non-critical-csshttps://web.dev/extract-critical-css/
In a future version of the Angular CLI `inlineCritical` will be enabled by default.
Closes: #17966Closes: #11395Closes: #19445
Copy file name to clipboardExpand all lines: packages/angular/cli/lib/config/schema.json
+23-3Lines changed: 23 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -715,7 +715,7 @@
715
715
"additionalProperties": false
716
716
},
717
717
"optimization": {
718
-
"description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.",
718
+
"description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.",
719
719
"oneOf": [
720
720
{
721
721
"type": "object",
@@ -726,9 +726,29 @@
726
726
"default": true
727
727
},
728
728
"styles": {
729
-
"type": "boolean",
730
729
"description": "Enables optimization of the styles output.",
731
-
"default": true
730
+
"default": true,
731
+
"oneOf": [
732
+
{
733
+
"type": "object",
734
+
"properties": {
735
+
"minify": {
736
+
"type": "boolean",
737
+
"description": "Minify CSS definitions by removing extraneous whitespace and comments, merging identifiers and minimizing values.",
738
+
"default": true
739
+
},
740
+
"inlineCritical": {
741
+
"type": "boolean",
742
+
"description": "Extract and inline critical CSS definitions to improve first paint time.",
743
+
"default": false
744
+
}
745
+
},
746
+
"additionalProperties": false
747
+
},
748
+
{
749
+
"type": "boolean"
750
+
}
751
+
]
732
752
},
733
753
"fonts": {
734
754
"description": "Enables optimization for fonts. This requires internet access.",
Copy file name to clipboardExpand all lines: packages/angular_devkit/build_angular/src/browser/schema.json
+23-3Lines changed: 23 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@
57
57
"additionalProperties": false
58
58
},
59
59
"optimization": {
60
-
"description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.",
60
+
"description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.",
61
61
"x-user-analytics": 16,
62
62
"default": false,
63
63
"oneOf": [
@@ -70,9 +70,29 @@
70
70
"default": true
71
71
},
72
72
"styles": {
73
-
"type": "boolean",
74
73
"description": "Enables optimization of the styles output.",
75
-
"default": true
74
+
"default": true,
75
+
"oneOf": [
76
+
{
77
+
"type": "object",
78
+
"properties": {
79
+
"minify": {
80
+
"type": "boolean",
81
+
"description": "Minify CSS definitions by removing extraneous whitespace and comments, merging identifiers and minimizing values.",
82
+
"default": true
83
+
},
84
+
"inlineCritical": {
85
+
"type": "boolean",
86
+
"description": "Extract and inline critical CSS definitions to improve first paint time.",
87
+
"default": false
88
+
}
89
+
},
90
+
"additionalProperties": false
91
+
},
92
+
{
93
+
"type": "boolean"
94
+
}
95
+
]
76
96
},
77
97
"fonts": {
78
98
"description": "Enables optimization for fonts. This requires internet access.",
0 commit comments