wp-rocket icon indicating copy to clipboard operation
wp-rocket copied to clipboard

Webp caching could target the inline CSS background images

Open piotrbak opened this issue 4 years ago • 14 comments

Is your feature request related to a problem? Please describe. When using WebP caching we are targeting most HTML images. We're not targeting the images set as background images of the HTML elements.

Describe the solution you'd like We could find them in the source and replace them with Webp version if exists

piotrbak avatar Jan 20 '21 18:01 piotrbak

Related: https://secure.helpscout.net/conversation/1605936940/288558?folderId=3864740

NataliaDrause avatar Aug 23 '21 13:08 NataliaDrause

Related: https://secure.helpscout.net/conversation/1626925839/293695/

vmanthos avatar Sep 15 '21 12:09 vmanthos

Related: https://secure.helpscout.net/conversation/1717395030/312699?folderId=3864740

NataliaDrause avatar Dec 06 '21 19:12 NataliaDrause

Related - https://secure.helpscout.net/conversation/1716689123/312583/

DahmaniAdame avatar Dec 08 '21 07:12 DahmaniAdame

We should do the same for Used CSS as well.

DahmaniAdame avatar Dec 08 '21 08:12 DahmaniAdame

This one will be difficult to implement without a big rewrite of the existing code in my opinion. It's also still in the old architecture, so we would take the opportunity to move it to the new one at the same time.

Maybe we can work on it, but it would fit more for a major version to be safer?

remyperona avatar Jan 17 '22 20:01 remyperona

Related https://secure.helpscout.net/conversation/1802271345/329008?folderId=2675957

camilamadronero-zz avatar Mar 03 '22 15:03 camilamadronero-zz

@piotrbak @Tabrisrp if we move convert_to_webp buffer priority after lazyload, and add data-bg to the target markup, we should be able to achieve that without requiring any major overhaul of the code. 

I tested that by moving covert_to_web to 19 as a buffer priority (lazyload has a buffer priority of 18), and added data-bg to rocket_attributes_for_webp. The conversion worked properly.

But it will be dependent of the images lazyload feature though.

DahmaniAdame avatar Mar 17 '22 12:03 DahmaniAdame

Related - https://secure.helpscout.net/conversation/1816270290/331688?folderId=3864735

DahmaniAdame avatar Mar 17 '22 12:03 DahmaniAdame

Related - https://secure.helpscout.net/conversation/1968899781/359935/

DahmaniAdame avatar Aug 05 '22 12:08 DahmaniAdame

Related - https://secure.helpscout.net/conversation/1999551773/366195/

joejoe04 avatar Sep 06 '22 16:09 joejoe04

Related: https://secure.helpscout.net/conversation/2334688098/438069/

girlie avatar Aug 22 '23 12:08 girlie