The problem is that this puts the gif <source> ahead of the webp <img> fallback, which causes the user agent to prefer the gif version. This particular image was not downsampled because it's pretty small, so no webp <source> was produced, but when it is produced, the order looks like this:
gif <source>
webp <source>
webp <img>
I would prefer:
webp <source>
gif <source>
gif <img>
As this would allow browsers that don't support <picture> and browsers that don't support webp to both fall back on gif. Otherwise, the webp version is loaded.
I noticed that the test that this change breaks really tested for the Could not find the lowest <img> source for responsive markup for undefined logic. So I re-added a specific test for that to replace the gif-specific behavior test.
I think I'm facing the same issue as #164, so I updated @iamschulz's PR with tests and I'll respond to #164#issuecomment-1409449689 here:
My options are:
When I run a gif through eleventy-img, I get this markup (line breaks added for readability):
The problem is that this puts the gif
<source>
ahead of the webp<img>
fallback, which causes the user agent to prefer the gif version. This particular image was not downsampled because it's pretty small, so no webp<source>
was produced, but when it is produced, the order looks like this:<source>
<source>
<img>
I would prefer:
<source>
<source>
<img>
As this would allow browsers that don't support
<picture>
and browsers that don't support webp to both fall back on gif. Otherwise, the webp version is loaded.I noticed that the test that this change breaks really tested for the
Could not find the lowest <img> source for responsive markup for undefined
logic. So I re-added a specific test for that to replace the gif-specific behavior test.