-
Notifications
You must be signed in to change notification settings - Fork 4k
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
All registered fonts being enqueued; Jetpack fonts module leads to 24,000 lines of CSS #48263
Comments
I've added instructions to reproduce the issue with only gutenberg, wp-env, and a test plugin. |
Reproduction ReportThis is a confirmation of this issue using a local nginx install. Environment
Actual Results
Additional InformationThe test plugin also triggers deprecation notices for |
I've created #48341 to address this issue. It's getting late 😪, so if I've missed something, LMK and I can check it in the morning. |
Thank you @ironprogrammer for investigating 🥇 PR #48341 does indeed resolve the issue. Root cause follow-up: The root cause is missing that the original (now deprecated) origin also needed to be considered in Why? To ensure plugins using the deprecated API's functionality are also skipped in |
#48341 fixes this issue |
Description
When Jetpack registers fonts to make them generally available, Gutenberg is enqueuing them even if they aren't used, causing unneeded font css to render to the front-end of sites.
gutenberg_register_fonts_from_theme_json()
and all registered fonts are enqueuedEnd result: There is no distinction between fonts that are only registered, and fonts that are registered and enqueued. All registered fonts are enqueued even if not used, causing extra font CSS to be rendered on the front-end.
I believe this bit of code is related:
On WPCOM, I see the bug begin to happen when WPCOM started to use Gutenberg 15.1.1.
Step-by-step reproduction instructions
Gutenberg + wp-env only
This can be reproduced by using this test plugin which imitates Jetpack's Google Fonts module. Tested using commit a9db335 2023-02-21 19:16 +0100.
The
.wp-env.json
file should now point to the new plugin:If all went well, the wp-admin plugins page should show the new plugin:
Now visit http://localhost:8888/ and view source.
WPCOM + Jetpack + Gutenberg
https://wordpress.com/start/
and create a new free siteScreenshots, screen recording, code snippet
Environment info
wp-env off commit a9db335 2023-02-21 19:16 +0100
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
No
The text was updated successfully, but these errors were encountered: