the fonts-files themselves are downloaded from fonts.gstatic.com, so the preconnect makes a lot of sense. in testing also preconnecting to https://fonts.googleapis.com made little impact (for the simple reason the domain is ‘hit’ before or at the same time as the preconnect), but you can simply add that to the preconnect-field yourself 🙂
hope this clarifies,
frank
Somehow I completely missed that preconnect field. I must have glossed over because it’s marked “advanced,” for which I’m not.
Also, my theme includes a dns-prefetch for https://fonts.googleapis.com/ that is stripped out by Autoptimize. Is there a way to prevent this from happening or is there really no need to?
Also, my theme includes a dns-prefetch for https://fonts.googleapis.com/ that is stripped out by Autoptimize
that’s a bug; it should only remove the prefetch if you remove google fonts or if you “aggregate & async fonts”, so I’ll look into that.
hmmm … not sure it makes sense to leave that dns-prefetch, as the very first linked CSS, considerably before the dns-prefetch, is the google fonts one;
<!DOCTYPE html><html lang="en-US" class="no-js no-svg"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" id="ao_optimized_gfonts" href="https://fonts.googleapis.com/css?family=Libre+Franklin%3A300%2C300i%2C400%2C400i%2C600%2C600i%2C800%2C800i#038;subset=latin%2Clatin-ext" /><...><link rel="stylesheet" media="all" href="//127.0.0.1/wordpress/wp-content/cache/autoptimize/css/autoptimize_6e44e2ecee3e5d96dc995d2a15ba5aca.css" /><title>thinkpress</title><...><link rel='dns-prefetch' href='//fonts.googleapis.com' /><...>
so in the end I think the dns-prefetch is useless and it’s indeed the right thing to remove it.