Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Conversation

@ghost
Copy link

@ghost ghost commented Apr 25, 2017

dramatically reduces page load time, jank and image data consumption

fixes #30, relates to gohugoio/hugoThemes#244

@bep
Copy link
Member

bep commented Apr 25, 2017

@digitalcraftsman might have more insight, but we already have a lazy loader:

b0a25ab

Not saying which one is better, we cannot have two!

@ghost
Copy link
Author

ghost commented Apr 25, 2017

@bep It does not work. I will remove unveil.

dramatically reduces page load time, jank and image data consumption

fixes #30, relates to gohugoio/hugoThemes/issues/244
@bep
Copy link
Member

bep commented Apr 25, 2017

It works fine for me in Chrome.

@ghost
Copy link
Author

ghost commented Apr 25, 2017

It works fine for me in Chrome.

It doesn't work for me in Chrome, nor does it work for WebPageTest. Please see the metrics I've provided. I've removed the previous loader, which is subpar because:

  1. It uses jQuery and has to wait for the entire page to parse, and jQuery and all other jQuery dependencies to load, as configured, before activating
  2. It should not be unsetting the src attribute of images. Lazysizes properly uses those for LQIP, and whenever a src attribute is provided a browser will try and load them if the script isn't fired immediately (which may explain why it works on your machine).
{{ with .twitter }}<meta name="twitter:creator" content="@{{ . }}"/>{{ end }}
{{ end }}{{ end }}

<script async defer src="/js/lazysizes.min.js"></script>
Copy link
Author

@ghost ghost Apr 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note defer here is not necessary but has been added as a convenience for older versions of Internet Explorer, which do not make use of the async attribute.

@bep
Copy link
Member

bep commented Apr 25, 2017

OK; let us test it.

@bep bep merged commit 4c8301d into gohugoio:master Apr 25, 2017
@ghost
Copy link
Author

ghost commented Apr 25, 2017

Thanks for the merge. Here are the updated metrics:
http://speed.habd.as/themes_gohugo_io-cable/?period=day

screen shot 2017-04-26 at 7 25 27 am

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

1 participant