hydecorp / hydejack

A boutique Jekyll theme for hackers, nerds, and academics
https://hydejack.com
Other
1.39k stars 789 forks source link

Feature Request: serve webp unless ios #231

Open DavidSchirduan opened 4 years ago

DavidSchirduan commented 4 years ago

I know the webp image format is slowly taking over and offers massive savings in data without must loss of quality.

However safari and ios still don't support webp.

Normally I could use liquid and some elements to serve webp files safely, but the hydejack image processing doesn't play nicely with these.

Might be a nice feature for jekyll to automatically use the .webp version if it exists.

qwtel commented 3 years ago

WebP is already yesterday's news ;) AVIF would be the way to go.

You could hack around with jekyll-replace-img to replace all img tags, but I'm not sure it would work without also rewriting parts of the CSS. I might take a look at it myself sometime, but it will take a while

DavidSchirduan commented 3 years ago

The internet moves too fast for me! Thanks for considering it; I'll see if I can devise a temp solution for now.

SebStange commented 2 years ago

There is actually a fairly decent fallback solution, which I assume could be implemented as part of the hy-img component.

<picture>
  <source type="image/avif" srcset="image.avif" />
  <source type="image/webp" srcset="image.webp" />
  <img src="image.jpg" srcset="image.png" alt="Some Image" />
</picture>

More details can be found here, including debugging/testing tips.