I need to change all images of a static website and provide WebP support. So every file-name.jpg
file has file-name.webp
alternative in the same folder.
I want to turn every
<img src="file-name.jpg" class="classnames" >
into
<picture>
<source srcset="file-name.webp" type="image/webp">
<img src="file-name.jpg" class="classnames" >
</picture>
I don't want to manually change all the photos by going through all the pages one by one. Is there a way to bulk replace all existing elements while keeping all class and attributes?