Roots Discourse

Sage 9 and webp image format

Hi there,

With Google Page Speed Insights now requiring a next-gen images formats (webp or avif) to get a good score, I’m looking for a way to get Sage to automatically generate (and serve?) webp images of the theme.

I’ve been using the WebP Converter for Media – Convert WebP & Optimize Images – WordPress plugin | WordPress.org plugin for the Media Library with Bedrock and it’s working well for me so far, but for the theme images I haven’t found a way.

The WP Rocket plugin offers a solution with WP Smush, but it’s quite expensive, I’d rather have a free solution.

Anyone looked into this ? I’ve read some old topics about it but could not find a good solution.

Cheers

You’ll have to modify the webpack config in Sage 9 to pull it off, but does this help?

I’m not a fan of image compression or optimization being done at the theme level anymore and would suggest looking into a image CDN service to just automate this sort of thing

Thanks for your answer @benword , I will have a look into it and post my solution.

Since image compression is included by default in Sage 9 when doing a production build, I thought it would be the way to go. And it’s always possible to add CDN on top of it.

Which CDN / Solution would you recommend ?

The Sage 9.x update branch may be interesting:

It updates Sage 9.x to webpack 5 and also updates the other dependencies.

Thanks for the suggestion @srarsis !
Sadly the current projects I’m referring to are in production, I cannot update them, I need to add this in existing Sage projects.