tomfran / typo

A simple Hugo theme
https://tomfran.github.io/
MIT License
247 stars 76 forks source link

Optimize images in README #40

Closed runofthemillgeek closed 2 weeks ago

runofthemillgeek commented 2 weeks ago

Noticed that images in the README of this project are way too large and hence slows down page load to this repo. I converted them into webp which has reduced the size dramatically while mostly preserving the quality needed:

❯ git branch --show-current
main
❯ l
Permissions Size User     Date Modified Name
.rw-r--r--  1.1M sangeeth 30 Oct 01:12  1.png
.rw-r--r--  1.1M sangeeth 30 Oct 01:12  2.png
.rw-r--r--  1.2M sangeeth 30 Oct 01:12  3.png
.rw-r--r--   55k sangeeth 30 Oct 01:12  banner-light.png
.rw-r--r--  644k sangeeth 30 Oct 01:12  screenshot.png
.rw-r--r--  598k sangeeth 30 Oct 01:12  tn.png
❯ gco chore/optimize-readme-images
Switched to branch 'chore/optimize-readme-images'
Your branch is up to date with 'origin/chore/optimize-readme-images'.
❯ l
Permissions Size User     Date Modified Name
.rw-r--r--  234k sangeeth 30 Oct 01:12  1.webp
.rw-r--r--  228k sangeeth 30 Oct 01:12  2.webp
.rw-r--r--  318k sangeeth 30 Oct 01:12  3.webp
.rw-r--r--  9.3k sangeeth 30 Oct 01:12  banner-light.webp
.rw-r--r--  168k sangeeth 30 Oct 01:12  screenshot.webp
.rw-r--r--  126k sangeeth 30 Oct 01:12  tn.webp

This should also make it easier to do shallow clones of this repo but it might be worthwhile cleaning up the large images in older commits to make it faster to do a full clone. But that's a bigger task and would need force pushes.

tomfran commented 2 weeks ago

Nice work, I'll take care of force pushing if it's not too destructive.

tomfran commented 2 weeks ago

Wait I saw that you changed the urls in the README, they are like this so https://themes.gohugo.io/themes/typo/ can render them correctly. Please change them to the raw path. Also, now that I think about this, I hope webp can be rendered correctly on that website.

runofthemillgeek commented 2 weeks ago

Ah, my bad. I had a feeling that could be the case too. Sure thing, will fix that.

I believe rendering shouldn't be affected but the user must be using a newer browser with webp support which looks great these days: https://caniuse.com/?search=webp

runofthemillgeek commented 2 weeks ago

@tomfran updated it. Tested render by changing the extension to .png locally so once webp files are there, should reflect that.