-
Notifications
You must be signed in to change notification settings - Fork 109
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
Load Google Fonts Asynchronously - not loading all weights with css2 #679
Comments
I copied the updated code from repository https://github.com/typekit/webfontloader/tree/master and it fixed: litespeedtech#679
@kokers Are you able to test some changes to the plugin files? |
@timotei-litespeed sure, let me pull this commit and test it. Will let you know if that fix it. |
@kokers quick answer :)) |
Just try on a staging site. That code is in development. |
Maybe take just the JS files content |
Sorry it took a bit but needed to make sure. Of course doing this on staging no worries. It doesnt work. I had originally just a code in You can see that its not, cause in sources the CSS url includes This is when Load Google Fonts Async is OFF This is when Load Google Fonts Async is On This is the code for font:
|
Does the page have multiple google font links? |
They are loaded with only single weight. look at the CSS that has been pulled. it's only 400. All other weights are missing. This is correct source that we should see: It's not that font is not loaded. It's that only default (400) weight is, cause Now it's time to figure out if it's a webfontloader issue, or there is some swap happening in LS cache plugin that changes |
That webkit version is oldddd I tried to add css2(as in other pull requests) but no luck. I am trying to find support for both V2 and V1. |
New commit: timotei-litespeed@150c214 How I tested:
style.css
|
One thing I needed to add is: ....1,900&display=swap', [], null ); @kokers sorry for late answer |
I have revisited my work and the correct test will be from: timotei-litespeed@e72f969 Still the wp_enqueue_style paramers 2 and 3 needs to be present. |
Will test on Monday and confirm :) |
This doesn't work. It pulls the first weight only and not all of them. With the syntax 100...400 it needs to pull 100,200,300,400 so the Essentially current fix is how it worked in the moment I posted the issue, cause font loader was able to get only the first one and ignored the rest of the syntax. |
Beside that, is there other bugs? |
No, but the issue I submitted is about that.
So this solution doesnt change anything apart from adding extra code. |
But if you have italic you have to also get italic 300, italic 400, italic 500... Yes? |
Good catch. yes. |
This should fix: timotei-litespeed@2bd5a53 |
Nice! Looks like it works now, thank you |
The solution is limited la what CSS v1 can do, but will do the trick for now. |
And thank you for testing the solution :) |
Looks like google fonts are not fully loaded when the embed code uses the new API
css2
. Only the default weight (400) is being pulled.Url is build like this:
https://fonts.googleapis.com/css2?family=Manrope:[email protected]&display=swap
Looks like webfontloader doesnt handle css2 correctly. Might need a library update. Found one very old issue still open typekit/webfontloader#430 Not sure when google made a switch, but they generate embed codes now on google fonts with the css2 links.
Old API with links https://fonts.googleapis.com/css?family=Manrope:300,400,600,700,800 work ok.
The text was updated successfully, but these errors were encountered: