-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic Inlining of Fonts breaks in Angular 11 #19350
Comments
Ah i found the document about how to turn this off... but i would not recommend having this on by default, doesn't appear to work properly |
cc @alan-agius4 |
It appears that the root problem is caused by a multiline comment in the response which is not handled properly in our minifier. I have a PR inflight to fix this #19352. Also, kindly find below the answer to your questions.
As you mentioned, the docs for this are available https://angular.io/guide/workspace-config#optimization-and-source-map-configuration
This is a critical performance optimisation to reduce the First Contentful Paint. See: https://blog.angular.io/version-11-of-angular-now-available-74721b7952f7 and #18730 for the motivation behind this feature.
This optimization is still beneficial if you use service workers because first time visitors will not have the service worker installed. Resources from external domains are not cached by the service-worker unless, you have configured the service worker to cache such resources, In which case you'll see the benefit of this after the 2nd visit of the application., because during the 1st visit the SW get installed, during 2nd the requests get cached and 3rd visit serve the request from cache. None-the-less, having the CSS of fonts inlined inlined in the HTML is still be slightly more performant. |
Hold up, For example, i'm using
|
Would also like to mention that fonts from fonts.google.com add |
This approach doesn’t take away the benefits of display swap. If anything it’s complimentary and users should still use display swap. Adding display swap if one of the many steps that needs to be done to achieve better FCP. Other complimentary approaches which we are currently working on, is inlining of critical CSS. The FCP is improved even further when inlining the external CSS rule definitions because each external CSS has a performance bottle neck, because it needs to be downloaded and parsed all this while rendering is blocked. When the external CSS is an on another domain, the bottle neck is even more because of addition DNS resolutions and connection creation which can take a couple of hundreds of milliseconds. |
Seems risky to cache these at build time.
They could change due to licensing issues or bug fixes etc |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 bug report
Is this a regression?
Yes, the previous version in which this bug was not present was: 10
Description
This update to Angular 11 prevents our fonts from loading when linked from (fonts.google.com)
in my
index.html
I have the followingThat link goes to the following url
Which appears to be converted into the following when built for production:
Missing are the
@font-face
forRoboto
andMaterial Icons
.Unclear how these are being evaluated but used you should also consider CSS custom variable assignments such as:
🔬 Minimal Reproduction
see above
🌍 Your Environment
Angular Version:
The text was updated successfully, but these errors were encountered: