Is there any way the plugin could detect the parent node of the image for a <picture> element and:
- only wrap the
<img> if it is not already in a picture
- preserve any already present
<source> as a sibling to the generated webp source
Current behaviour
Input:
<picture>
<source type="image/avif" srcset="images/my-image.avif 1x, images/my-image@2x.avif 2x">
<img srcset="images/my-image.jpg 1x, images/my-image@2x.jpg 2x" alt="">
</picture>
Output:
<picture>
<source type="image/avif" srcset="images/my-image.avif 1x, images/my-image@2x.avif 2x">
<picture>
<source type="image/webp" srcset="images/my-image.webp 1x, images/my-image@2x.webp 2x">
<img srcset="images/my-image.jpg 1x, images/my-image@2x.jpg 2x" alt="">
</picture>
</picture>
Expected behaviour
<picture>
<source type="image/avif" srcset="images/my-image.avif 1x, images/my-image@2x.avif 2x">
<source type="image/webp" srcset="images/my-image.webp 1x, images/my-image@2x.webp 2x">
<img srcset="images/my-image.jpg 1x, images/my-image@2x.jpg 2x" alt="">
</picture>
Use case
This could also be useful when several different plugin are trying to add sources to a picture.
Thanks
Is there any way the plugin could detect the parent node of the image for a
<picture>element and:<img>if it is not already in a picture<source>as a sibling to the generated webp sourceCurrent behaviour
Input:
Output:
Expected behaviour
Use case
This could also be useful when several different plugin are trying to add sources to a picture.
Thanks