Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Frank Goossens

    (@futtta)

    Evening Gberk;
    ‘remove google fonts’ (currently) only works for gfonts that are included via CSS in the HTML, so the webfont.js would not get removed.

    The css?family= call would normally get removed however, except if it is sourced in by JS instead of the “traditional” CSS-link. So check your HTML source to see if you see https://fonts.googleapis.com/css?family= in there?

    I’ll be happy to have a look myself if you can post your site’s URL here.

    hope this clarifies,
    frank

    Thread Starter Gberk

    (@gberk)

    Hi Frank, yes, https://fonts.googleapis.com/css?family= is in the source code.

    Plugin Author Frank Goossens

    (@futtta)

    well, if it’s inside a link as src with rel=stylesheet and you’re optimizing CSS, then yes it should be removed. if it’s not, it’s probably a bug which I’d love to squash, but then we’ll need to dive into the specifics of your installation. can we?

    frank

    Thread Starter Gberk

    (@gberk)

    How do we do that? The site is https://zebedeuscafe.nl

    Plugin Author Frank Goossens

    (@futtta)

    ok, had a quick look, all google fonts code in the HTML is actually JS, there’s no direct call to google fonts using the CSS method like for example this one;

    <link href='//fonts.googleapis.com/css?family=Open+Sans:400&subset=latin' rel='stylesheet' type='text/css'>

    hence AO can’t remove the call as it’s initiate by JS.

    now the good news; you can tell AO to remove the google fonts JS as well, using the API. try code like this one (using code snippets for example);

    add_filter('autoptimize_filter_js_removables','gberk_remove_gfonts');
    function gberk_remove_gfonts() {
        return "webfont.js";
    }

    en doe mij maar de gamarineerde zalm ??

    groetjes,
    frank

    Thread Starter Gberk

    (@gberk)

    Great! But how do I remove the fonts.googleapis.com call?

    Thread Starter Gberk

    (@gberk)

    I think I did it with

    add_filter('autoptimize_filter_css_removables','gberk_remove_goofntscss');
    function gberk_remove_goofntscss() {
        return 'fonts.googleapis.com';
    }

    Als je in de buurt bent krijg je de zalm! ??

    Thanks!

    Plugin Author Frank Goossens

    (@futtta)

    great!

    fijne avond nog!
    frank

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Google Fonts not removed?’ is closed to new replies.