Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Try replacing bundled images with WebP versions #236

Closed
wants to merge 2 commits into from
Closed

Conversation

kjellr
Copy link
Collaborator

@kjellr kjellr commented Nov 15, 2021

Replaces #132. Props to @audrasjb for the idea. This PR swaps out the bundled images with WebP versions. Quality for all images should be the same as the original versions, but this saves us ~800k total (45% savings).

I'd like to get one last gut-check on using WebP here before we merge — my main concern is that there is no fallback in place here. Although browser support is pretty good, I'm a little concerned that these images won't work at all for Safari users who don't have Big Sur installed. That software was only released in November 2020, so it's still relatively recent. I'm going to do some asking around about that, but feel free to share thoughts or concerns here. Thanks!

@kjellr kjellr self-assigned this Nov 15, 2021
@kjellr kjellr changed the title Try bundled images with WebP versions Try replacing bundled images with WebP versions Nov 15, 2021
@audrasjb
Copy link
Contributor

Looks great, thanks for handling this @kjellr !

Copy link
Collaborator

@jffng jffng left a comment

Choose a reason for hiding this comment

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

feel free to share thoughts or concerns here.

Granted I'm a use case of one, but I'm still on Catalina (haven't upgraded because it always breaks docker), so this PR breaks the images on Safari for me.

@desrosj
Copy link
Contributor

desrosj commented Nov 16, 2021

my main concern is that there is no fallback in place here. Although browser support is pretty good, I'm a little concerned that these images won't work at all for Safari users who don't have Big Sur installed. That software was only released in November 2020, so it's still relatively recent.

I share this concern. Even though the savings are significant, I lean towards opting for wider compatibility than smaller size at this stage. Since this is the default theme for new installs, it's not unreasonable to assume that non-technical users will encounter a problem with WebP images and have no idea why it's happening, or even how to fix the issue.

Would there be any way to give a choice to the site owner with JPG as the default?

@adamsilverstein
Copy link
Member

Would there be any way to give a choice to the site owner with JPG as the default?

The markup could use the picture element which lets us serve WebP in browsers that support it while falling back to jpeg for browsers that do not. That would mean shipping both sets of images though, negating some/most of the value of this change.

We could also consider a polyfill https://github.com/chase-moskal/webp-hero

@kjellr
Copy link
Collaborator Author

kjellr commented Nov 18, 2021

We can't modify the markup to use a picture element because it's provided by Gutenberg, and I'm not okay with including a polyfill for this particular theme — we're aiming to keep it as simple and lightweight as possible.

Given that (and given that my co-lead for the theme has turned out to be the exact sort of user this won't work for 😅), I think we should close for now. Let's just focus on getting the most out of the JPG + PNG images we have now, and take a look at WebP again for the next default theme.

I have opened an upstream issue to start a discussion about allowing fallbacks via the picture element: WordPress/gutenberg#36629

Thanks for the help and feedback on this, everyone!

@kjellr kjellr closed this Nov 18, 2021
@kjellr kjellr deleted the try/webp-images branch November 18, 2021 20:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants