skip to Main Content

Is there a way to get the google-font compressed from the server?
When I get the css for the fonts from google’s server it looks like this:

/* cyrillic-ext */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v16/ek4gzZ-GeXAPcSbHtCeQI_esZW2xOQ-xsNqO47m55DA.woff2) format('woff2');
  unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
}
/* cyrillic */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v16/mErvLBYg_cXG3rLvUsKT_fesZW2xOQ-xsNqO47m55DA.woff2) format('woff2');
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
 .
 .
 .
 etc
}

The styles aren’t compressed(delete the comments and remove white spaces) therefore I get less reputation on PageSpeed Insights wich means less SEO and I also get less perform in my web-page.
I don’t want to use @import since it’s not recommended.

2

Answers


  1. According to this online post here (https://discourse.roots.io/t/best-way-to-use-google-fonts/455/2) you cannot load the fonts minified directly from the good servers. However, you could minify the code yourself, either manually or a website such as https://cssminifier.com/.

    Hope this answers your question.

    Login or Signup to reply.
  2. According to the documentation and my experience you can have optimization only trough specifying script subsets or using the Web Font Loader.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search