Answer the question
In order to leave comments, you need to log in
Is there a galp plugin to add a picture tag?
Tell me if there is a plug-in for the gallp so that when building a project where I just have an img tag, it would wrap it in a picture and add the webp format there for pictures that are in img?
Answer the question
In order to leave comments, you need to log in
And it would be better to have a plug-in right away, which with the only method "do it well" :)
There are no such plug-ins, and if there is, I do not advise it. Picture is not an image, not shadow-dom magic, it's a wrapper over the image, a physical wrapper, a real one. Basically you want to wrap the image in .
Both it and the picture inside it must be styled differently. And in the case of automatic wrapping, how do you know what and how to style? And how will you mark the images so that they don’t turn around if you don’t need to? Are you sure it's always necessary?
There are plugins that will make duplicates of your images in webp and put them next to or in a separate folder.
And picture - write yourself.
If you are too lazy to type - use snippets, if you use a component approach - get some `base-picture` component, into which you pass the URL of the main image, and a `webp` type prop set to `true` by default, which in the context of logic component will mean that the webp version needs to be added automatically by replacing the extension in the passed main image (well, or through any logic that you need). The only way.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question