T
T
TedMarsh2021-08-09 14:00:00
gulp.js
TedMarsh, 2021-08-09 14:00:00

How to add srcset attribute to Gulp (retina)?

Using the gulp-webp plugin, I convert images to webp and using image-image-resize I create a retina and the following structure is obtained:

img/
     img.jpeg
     img.webp
     [email protected]
     [email protected]


The gulp-webp-html plugin added webp instead. And the plugin gulp-img-retina retina (srcset) to the source and img tags, but added only to img:<img src="img.jpeg">

<picture>
       <source srcset="img.webp" type="image/webp">
       <img src="img.jpeg" alt srcset="img.jpeg 1x, [email protected] 2x">
 </picture>


What plugin or function can be used to add the srcset attribute to the source tag?
Would like to get something like this:

<picture>
       <source srcset="img.webp 1x, [email protected] 2x" type="image/webp">
       <img src="img.jpeg" alt srcset="img.jpeg 1x, [email protected] 2x">
 </picture>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question