Skip to content
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

Add versioning for fonts #424

Merged
merged 5 commits into from
Aug 22, 2023
Merged

Add versioning for fonts #424

merged 5 commits into from
Aug 22, 2023

Conversation

dd32
Copy link
Member

@dd32 dd32 commented Aug 22, 2023

After #173 I realised that fonts weren't being handled correctly.

The <head> includes:

<link rel='preload' href='https://wordpress.org/wp-content/mu-plugins/pub-sync/global-fonts/Inter/Inter-latin.woff2' as='font' crossorigin='crossorigin' type='font/woff2' />

But that's no longer the URL, as the style.css is loaded from the cdn:

<link rel='stylesheet' id='wporg-global-fonts-css' href='https://s.w.org/wp-content/mu-plugins/pub-sync/global-fonts/style.css?ver=4c78359bcbb5' media='all' />

which would then load the following font, which does not match the preloaded URL.

https://s.w.org/wp-content/mu-plugins/pub-sync/global-fonts/Inter/Inter-latin.woff2

This PR...

  • Updates it to include a ?ver= query var
    • The QV allows for the files to be updated in future, as they're now cached.
    • On Sandboxes: This is the file mod time this will differ from style.css on sandboxes
    • On Production: The CDN plugin will use a file hash, which should match those in style.css.
    • On Production: Allows the CSS and preload to have the same URL
  • Removes EB Garamond 'arrows' subset, which doesn't seem to exist

After starting to write this PR, I've realised I didn't need to add the font hashes into the PHP, so have removed that.

@dd32 dd32 merged commit 97252b6 into trunk Aug 22, 2023
@dd32 dd32 deleted the add/cdn/fonts branch August 22, 2023 06:09
dd32 added a commit that referenced this pull request Aug 23, 2023
dd32 added a commit that referenced this pull request Aug 25, 2023
dd32 added a commit that referenced this pull request Aug 25, 2023
dd32 added a commit that referenced this pull request Aug 25, 2023
* Pass the font file to plugins_url().

* Add font hashes.

* Remove EB Garamond 'arrows' subset, it doesn't exist.

* Update font subset script to generate the CDN hashes.
dd32 added a commit that referenced this pull request Aug 25, 2023
@dd32 dd32 mentioned this pull request Aug 25, 2023
dd32 added a commit that referenced this pull request Aug 25, 2023
* Revert "Global Fonts: Fix the inline URLs after #424."
* Revert "Add CDN versioning for fonts (#424)"
* Revert "Add a CDNise mu-plugin (#173)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant