• Jetpack Genericons stylesheet causes a significant drop in grade by Pingdom. The message:

    The requests for the following URLs don’t fit in a single packet. Reducing the size of these requests could reduce latency.
    data:application/x-font-woff;charset=utf-8;base … AAAB//8AAnjaY2BgYGQAgosrjpwF0ZcUq9bCaABTzgdAAAA=
    MORE AT GOOGLE DEVELOPERS

    refers to /wp-content/plugins/jetpack/_inc/genericons/genericons/genericons.css

    @font-face {
      font-family: "Genericons";
      src: url("data:application/x-font-woff;charset=utf-8;...
      ...") format("woff"),
    ...

    Why not simply use de included file /wp-content/plugins/jetpack/_inc/genericons/genericons/Genericons.woff with

    @font-face {
      font-family: "Genericons";
      src: url("./Genericons.woff") format("woff"),
    ...

    like the other font files?

    https://wordpress.org/plugins/jetpack/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    My colleague Joen talked a bit about why we load the font files this way in this GitHub issue:
    https://github.com/Automattic/jetpack/issues/1273#issuecomment-62024985

    However, you’ll be happy to hear that we’re actually moving away from Genericons for most of the user facing features of Jetpack. We used to use Genericons for sharing buttons, but we’ve now switched to a better, lighter solution, dubbed Social Logos. Genericons are still used if you use the Social Media Icons Widget, but we’ll switch to Social Logos there as well soon. We’ll also continue to use Genericons inside your dashboard, in the mobile theme, as well as on the log in page if you use the SSO module.

    Where do you get that Pingdom grade? If that grade appears when you look at your home page, on desktop, when not using the Social Media Icons widget, I’d recommend updating to the most recent version of Jetpack and giving it another try.

    Let me know how it goes.

    Thread Starter Rolf Allard van Hagen

    (@ravanh)

    Hi Jeremy, thanks for explaining 🙂

    The genericons stylesheet is included on every page of a site that is not using the Social Icons widget at all. In fact, if I completely deactivate all Jetpack modules and even disconnect Jetpack, the stylesheet is still included.

    I suspect it is because the site is using the Dyad theme which offers a dedicated Social Links menu. But even when that menu is not used, the genericons are loaded. Should I file this on the theme’s forum?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    It looks like the theme enqueues Genericons by default, without any conditionals:
    https://themes.trac.wordpress.org/browser/dyad/1.0.10/functions.php#L228

    You could certainly post in the theme’s support forums to suggest a small improvement; if their Social Links menu is the only thing using Genericons in the theme, it would make sense to only enqueue Genericons when the menu is in use.

    Thread Starter Rolf Allard van Hagen

    (@ravanh)

    Hmmm, it looks like it’s used for more than just the social icons. I’ll have to replace it with my own version in a child theme…

    Thanks for your feedback and the tip about Social Logos! 🙂

    Thread Starter Rolf Allard van Hagen

    (@ravanh)

    One quick question: how can I override the genericons from Jetpack? I can dequeue with:

    function ev_replace_genericons() {
      wp_dequeue_style( 'genericons' );
    }
    add_action( 'wp_enqueue_scripts', 'ev_replace_genericons', 999 );

    But if I add this line to the function:

    wp_enqueue_style( 'genericons', get_stylesheet_directory_uri() . '/genericons/genericons.css', array(), '3.4.1.99' );

    for some reason the one from Jetpack is included again 🙁

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    It might easier to give your Genericons a unique name, like ravanh-genericons.

    Another alternative would nbe to deregister Jetpack’s Genericons completely, as done here for example:
    https://github.com/Ipstenu/genericond/blob/cdb1bc73aae659e1c1a2e05d2f6d2f9fd5f65049/genericons.php#L59-L65

    Thread Starter Rolf Allard van Hagen

    (@ravanh)

    Ah yes, wp_deregister_style not just wp_dequeue_style of course. I’m stupid. 😉

    I ended up giving a unique name which works too because there are no dependencies but if I had given it just a bit more thought…

    Thanks Jeremy, again, for your invaluable help!

    Can anyone advise if the social icons widget has been changed yet to remove genericons… I am still getting this reduced grade in pingdom.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    @kennywilliamson No, the widget still uses Genericons. We didn’t switch it to use SVG yet.

    Hi,
    I would like to disable genericons completely. I added

    	    wp_dequeue_style( 'genericons' ); // This is to force other plugins and themes with older versions to STFUN00B
    	    wp_deregister_style('genericons');

    to my functions.php but the genericons seems to still be loaded. Am I missing something ?

    Thread Starter Rolf Allard van Hagen

    (@ravanh)

    Hi @whatnextadventures what is your complete code? It might be a question of timing (trying to deregister something when it is not registered yet) notice the , 999 in my code snippet above.

    Hi @ravanh,
    I’m quite new to wordpress development. I didn’t knew you had to do a function then use add_action. It’s working now with this :

    
    	function wna_disable_genericon () {
    	global $wp_styles;
    	    if ( wp_style_is('genericons', 'registered') == TRUE) {
    		    wp_dequeue_style( 'genericons' ); // This is to force other plugins and themes with older versions to STFUN00B
    		    wp_deregister_style('genericons');
    	    }
    	}
    	add_action( 'wp_print_styles', 'wna_disable_genericon' );
    

    Thanks for your reply anyway 🙂

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Significant drop in Pingdom grade’ is closed to new replies.