-
Notifications
You must be signed in to change notification settings - Fork 385
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
Bundle common font files for externalizing data: URLs #3866
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
westonruter
commented
Dec 2, 2019
schlessera
approved these changes
Dec 3, 2019
westonruter
added a commit
that referenced
this pull request
Dec 4, 2019
* Bundle common font files for externalizing data: URLs * Skip guessing the specifically-bundled fonts * Add tests for fonts with data: URLs
westonruter
added a commit
that referenced
this pull request
Dec 4, 2019
3 tasks
Note: I failed to bump the cache group after the changes in this PR. Fixed in #3880. |
westonruter
added a commit
that referenced
this pull request
Dec 4, 2019
…meo-shortocode-support * 'develop' of github.com:ampproject/amp-wp: (159 commits) Return allowed KSES tags if not an array (#3879) Update dependency @wordpress/date to v3.6.0 (#3739) Update dependency @babel/plugin-proposal-object-rest-spread to… (#3813) Update dependency @babel/core to v7.7.4 (#3686) Update dependency @wordpress/api-fetch to v3.7.0 (#3731) Update dependency @wordpress/keycodes to v2.7.0 (#3745) Bundle common font files for externalizing data: URLs (#3866) Update dependency css-loader to v3.2.1 (#3870) Update dependency core-js to v3.4.7 (#3873) Update dependency core-js to v3.4.5 (#3695) Update dependency eslint-plugin-react to v7.17.0 (#3845) Update dependency eslint-plugin-jest to v23.1.1 (#3702) Update dependency eslint to v6.7.2 (#3811) Update dependency autoprefixer to v9.7.3 (#3850) Update dependency browserslist to v4.8.0 (#3849) Remove second sentence from paired browsing dialog Add async attribute to amp-paired-browsing-client script Restrict paired browsing to when dev mode is enabled Add robots noindex/nofollow meta tag in paired browsing app Remove extraneous method in favor of (temporary) closure ...
westonruter
added a commit
that referenced
this pull request
Dec 5, 2019
westonruter
added a commit
that referenced
this pull request
Dec 5, 2019
westonruter
added a commit
that referenced
this pull request
Dec 6, 2019
…id-markup-reason * 'develop' of github.com:ampproject/amp-wp: (143 commits) Update dependency @wordpress/block-editor to v3.3.0 (#3691) Update dependency @wordpress/editor to v9.8.0 (#3693) Update dependency @wordpress/compose to v3.8.0 (#3736) Use comment as array key for data set to show when failure happens Remove unused AMP_YouTube_Embed_Handler::sanitize_v_arg method after 7a97571 Bump stylesheet cache group after #3866 (#3880) Delete AMP_YouTube_Embed_Handler::shortcode() and oembed() Delete AMP_Twitter_Embed_Handler::oembed() Prevent wrapping plugin names in code tags Update dependency @wordpress/blocks to v6.8.0 (#3734) Update dependency @wordpress/core-data to v2.8.0 (#3737) Update dependency @wordpress/edit-post to v3.9.0 (#3692) Update dependency @wordpress/components to v8.4.0 (#3735) Update dependency @wordpress/element to v2.9.0 (#3741) Align @param descriptions in test_video_override Replace a call to ->shortcode() with the logic from shortcode() Refactor AMP_Vimeo_Embed_Handler::shortcode() into video_override() Deprecate AMP_YouTube_Embed_Handler::shortcode() Restore AMP_YouTube_Embed_Handler::video_override() Improve theme inline CSS checks ...
westonruter
added a commit
that referenced
this pull request
Dec 19, 2019
* tag '1.4.2': (25 commits) Bump 1.4.2 Bump 'tested up to' to 5.3.2 Catch unfiltered requests when testing Crowsignal embed (#3956) Bump version 1.4.2-RC1 Bump 'Tested up to' to 5.3.1 Remove test case for paired browsing since broken in WP4.9 and would not pass in AMP 1.4 (#3928) Further refine is_exclusively_dependent and add tests (#3928) Only include hoverintent-js in dev mode if exclusive dependency of admin-bar (#3928) Include admin-bar script deps in dev mode (e.g. hoverintent-js) (#3928) Fix tests after security fix in WP 5.3.1 (r46896) (#3926) Add E2E tests to allow_failures Convert `theme_features` variable into `get_theme_config` function Only apply smooth scroll fix on 'Twenty Twenty' <= 1.0.0 Re-add smooth scrolling fix on WP < 5.3.1 No need to apply smooth scrolling fix for Twenty Twenty theme Bump stylesheet cache group after #3866 (#3880) Return allowed KSES tags if not an array (#3879) Bundle common font files for externalizing data: URLs (#3866) Pull the built `block-libray` package from Gutenberg SVN if it does not exists (#3847) Optimize is_amp_allowed_attribute checking for reference points (#3815) ...
Verified in QA |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
I found that the Gutenberg demo post was causing excessive CSS errors in Twenty Twenty. Here's the CSS manifest:
It was forcing out the important
style#twentytwenty-style-inline-css
stylesheet.A big reason for this is the
data:
URL forNonBreakingSpaceOverride
, which includes this 3KB of CSS in the resultingamp-custom
stylesheet:The URLs in the
@font-face
here should actually have thedata:
URLs replaced with filesystem URL via this code:amp-wp/includes/sanitizers/class-amp-style-sanitizer.php
Lines 2233 to 2275 in 09f1461
This is what is being done in Twenty Nineteen:
The reason why this works in Twenty Nineteen but not Twenty Twenty is that it includes the woff/woff2 font files with the theme:
https://github.com/WordPress/wordpress-develop/tree/master/src/wp-content/themes/twentynineteen/fonts
This is not the case for Twenty Twenty.
In order to save on the 3KB of CSS for Twenty Twenty or any other theme that includes the
NonBreakingSpaceOverride
as adata:
URL but without including the file in the distributed theme, we can just include the file in the AMP plugin. We can also do this for other common fonts, like Genericons.With the changes in this PR, the CSS manifest for Twenty Twenty now becomes:
There is still an excessive CSS error, but it is for a print stylesheet which has less prioritization. More work is needed to see if we can further reduce the amount of CSS, but this is an improvement.
For the previous work done for Twenty Nineteen, see #2079.
This is part of adding theme support for Twenty Twenty (#3342).
Checklist