Support » Plugin: WebP Express » Alter HTML – inside

  • Yuval

    (@yuvalsabar)


    Hi,

    First of all – this is a wonderful plugin. I use it in all my websites.

    There is one small issue that is very disturbing. When I choose “Replace tags with <picture> tags, adding the webp to srcset”, and I already have a <picture> tag in the code, it will place a <picture> inside a <picture>, like in this screenshot: https://i.imgur.com/ekHU4Bz.png

    Would you be able to fix that?

    Another issue is that the plugin does not deal with inline background images when I’m choosing “Replace tags with <picture> tags, adding the webp to srcset” option.

    Thank you!
    Yuval

    • This topic was modified 4 months ago by Yuval.
    • This topic was modified 4 months ago by Yuval.
    • This topic was modified 4 months ago by Yuval.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author rosell.dk

    (@roselldk)

    Hi Yuval,

    You are right – Existing picture tags should be left untouched, or perhaps even better: webp sources should be added to it.
    It is a bit tricky. The code currently doesn’t parse the HTML. I could of course be changed to do that (and then modify, and then stringify) – but there is the danger that malformed HTML will be discarded. The current method is very gentle in that respect. To keep it gentle, I could remove all existing picture tags, do the replace and then insert them again. I will consider…

    Regarding background images, I’m not sure if there is a good way to convert them into picture tags. Do you have a suggestion?

    Thread Starter Yuval

    (@yuvalsabar)

    @roselldk thank you for the fast response.

    Regarding background images, maybe add an option to rewrite urls of just the background images, and use polyfill if the browser does not support that.

    Thanks for considering my suggestions. Either way – GREAT plugin πŸ™‚

    Plugin Author rosell.dk

    (@roselldk)

    @yuvalsabar: I have changed the underlying library so existing <picture> tags are preserved as is. It turned out it wasn’t too hard after all.

    Link to issue on github: https://github.com/rosell-dk/dom-util-for-webp/issues/24

    It will be available in the next release (not scheduled yet)

    Thread Starter Yuval

    (@yuvalsabar)

    @roselldk Awesome!!! Thank you SO much! πŸ™‚

    Thread Starter Yuval

    (@yuvalsabar)

    Hi @roselldk,

    Was this fixed in the new version?
    I can see the plugin has been updated 3 weeks ago, but I still have this issue.

    Thanks! πŸ™‚

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.