Dear All: I’m frequently in the situation where I generate content and know the image name, but not whether it’s jpeg
or png
or webp
or avid
. This occurs especially when I switch from jpeg
to avid
– that can save lots of space and I don’t want to rewrite the code.
So I’m thinking of an include
which receives an image name w/o extension and then tries out (using the plugin jekyll-file_exists.rb
) all formats until it finds one. My question now: does something like this already exist, so I don’t need to re-invent? I couldn’t find anything here nor elsewhere with medium recherche effort :).
Thanking in advance, Michael
I’ve not seen something like that and if you are going to have that run every time you build the project it sounds expensive. Not a problem on a small site I’m sure though.
Do you mean avif? avid doesn’t sound right.
Why not just do all the images at once and then use your editors find and replace to update them all? I’m sure a bunch of things would break but maybe not too bad to do all at once assuming the images are not in some nested folder structure. Even then you could probably write a command line thing to do it with Sharp in node.
I don’t see much purpose for png or jpeg any more - now that webp and avif are supported on the major browsers.
Thank you. Yes, of course, you’re right, avif
. I also wondered about computational costs, and some of my sites are quite large.
Ah, Sharp, hadn’t known that.