Kirki: Webfont.js Console Error

Created on 10 Jun 2017  路  7Comments  路  Source: kirki-framework/kirki

Issue description:

Even though I have no typography fields on my theme I keep getting this error in console
screen shot 2017-06-10 at 9 50 41 am

Version used:

(Did you try using the develop branch from github? There's a chance your issue has already been adressed there)
Yup, running latest dev version

bug typography postMessage webfonts

All 7 comments

Yeah, I know that happens I'm just still unsure if I should fix it or not.
While in the customizer, I use the webfontloader to allow live-updating the preview for typography controls with postMessage.
In order to improve performance I don't check if the selected font is an actual google font or not, so when a font-family is selected in a typography control, it tries to get that font from google fonts by default.
If it fails, then it throws an error in the console.

It's possible to fix it, but I'd have to check if the selected font is a google font or not, and that would require using wp_localize_script to add an object of all googlefonts in the script that handles the postMessage, and then check if the selected font exists in there before enqueueing it. All that extra data and checks would have some impact on performance.

The error in the console doesn't cause any actual issues which is why I didn't bother fixing it until now..

In this case is throwing an error because there's no font at all. You can at least check for that 馃槈

I believe this one was just fixed, can you please verify? Thanks!

Yes, error gone from the console.

Thanks for testing!

@manuelmoreale I have the similar issue when using kirki to load google font(Open Sans Condensed) in my site.
GET https://fonts.googleapis.com/css?family=Open+Sans+Condensed&subset net::ERR_ABORTED

It seems that the parameter in above link is missed.

Here is the snippet of definition in webfonts.php:

array("kind" => "webfonts#webfont", "family" => "Open Sans Condensed", "category" => "sans-serif", "variants" => array("300", "300italic", "700"), "subsets" => array("cyrillic", "greek-ext", "vietnamese", "greek", "latin-ext", "cyrillic-ext", "latin"), "version" => "v10", "lastModified" => "2016-10-05", "files" => array("300" => "http://fonts.gstatic.com/s/opensanscondensed/v10/gk5FxslNkTTHtojXrkp-xEMwSSh38KQVJx4ABtsZTnA.ttf", "700" => "http://fonts.gstatic.com/s/opensanscondensed/v10/gk5FxslNkTTHtojXrkp-xBEM87DM3yorPOrvA-vB930.ttf", "300italic" => "http://fonts.gstatic.com/s/opensanscondensed/v10/jIXlqT1WKafUSwj6s9AzV4_LkTZ_uhAwfmGJ084hlvM.ttf")),

@aristath I think the version we are using is old, but it is difficult to use latest version for us. Can you give us some suggestion to fix it? The version we are using is 2.3.7
Thanks and Merry Xmas.

@kingwinchan hello there and merry Christmas!

I think the version we are using is old, but it is difficult to use latest version for us.

Could you please elaborate? Why is it difficult for you to use the latest version? What exactly is the problem you have with the latest version?
v2.3.7 was released in Oct.2016 and although the inner workings of the plugin have changed a lot since then, I've spent a lot of time making sure it's almost 100% backwards-compatible so it should still work just by updating the plugin... If there's something that prevents you from updating to the latest version I'd rather resolve that than provide support for an old & deprecated version.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VladNov picture VladNov  路  6Comments

stylethemes picture stylethemes  路  6Comments

rinkuyadav999 picture rinkuyadav999  路  4Comments

ghost picture ghost  路  5Comments

daviedR picture daviedR  路  6Comments