Kikobeats / uno-urban

Simple and Elegant personal theme for Ghost.
https://kikobeats.github.io/uno-urban
8 stars 0 forks source link

PageSpeed Insights CSS and Fonts #8

Closed ghost closed 8 years ago

ghost commented 8 years ago

Is it somehow possible to get to nearly 100% with Google PageSpeed Insights? It is funny that it complains about the fonts from google. If not possible. No problem. Maybe something to consider for a later update or if you find some spare time.

Kikobeats commented 8 years ago

Impossible is nothing!

I tested with my site. The most important issue here is font load; I'm sure that should be exist a tricky way to load using javascript

Kikobeats commented 8 years ago

@ndalliard Google offers a script for do it:

<script type="text/javascript">
  WebFontConfig = {
    google: { families: [ 'Open+Sans:300italic,600italic,300,600:latin' ] }
  };
  (function() {
    var wf = document.createElement('script');
    wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })(); </script>

I'm going to deploy mi blog with this to know PageSpeed opinion 😄

ghost commented 8 years ago

Uhh, I just tested this. If you add it in the ghost_foot PageSpeed likes it. But not sure if it is okay to put that in the footer?!

Edit: Ah, when you load a page you can see, that the fonts are loaded a little bit later, so maybe thats not a really good enhancement. :smile:

Kikobeats commented 8 years ago

Yes, put the snippet in the footer and remove google font call from header.

Also related with this comment is very nice: http://stackoverflow.com/a/32764423

ghost commented 8 years ago

Oh nice link. I got it to 100% (without Google Analytics). But it kinda looks strange when it loads and the images from the article overview are not full width anymore. I will probably stay with the current release. Nice to know, that it is possible to get to 100%. Thanks for your great work Kiko!

Kikobeats commented 8 years ago

@ndalliard haha, finally what did you try?

I prefer maintain the current file request, maybe is more slow, but the experience of the site is correct.

In addition files of the page are small (less 50KB).

ghost commented 8 years ago

The script you mentioned in the footer and the media="bogus"thing mentioned in the sackoverflow link from you. That got me to 100%. But yeah. Absolutely fine how it is at the moment. Already rewerted back.