E
E
Evgeny2018-12-30 17:26:34
Images
Evgeny, 2018-12-30 17:26:34

Is there an NPM package to replace img with picture?

Hello!
The task before me is to automate the conversion of images from jpeg to webp, replacing img tags with picture in the markup, with serial links to images: first webp, then jpeg. The same in CSS.
Tell me, what ready-made solutions can be used?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Balya, 2019-01-16
Myagkikh @myagkikh_evgeniy

webpYou can use gulp-webp to create copies of images in a format . It makes an additional file with the same name as the original image, but in a format webp- very handy.
Then it is not necessary to wrap all images in , there is a simpler way using .htaccess . The idea is to spoof paths at the web server level depending on browser support. I also occasionally use gulp-webpcss in conjunction with Modernizr . <picture>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question