static-site-scaffold-modules
static-site-scaffold-modules copied to clipboard
[eleventy-plugin-local-respimg] Right way to exclude certain images or files
Currently, the plug will transform all <img> in an Eleventy project into <picture><img/><picture> tags. This may not be desirable for some images:
- ...that are used for UI. After respimg transform styles may break.
- ...
<img>already havesrcsetattribute set.
What would be an ideal way to exclude such images? I made an attempt to exclude through outputPath regex. But then realized, UI images will be present in all the pages. How can we exclude them?
Should we do class or data attribute based filtering? Ex. <img class="no-resp" ...> will not be touched?
Or, transform all <img> without any classes by default. Then, the <img> with classes need to be explicitly opted in like <img class="resp w-full" .../> or <img data-local-respimg="true" class="w-full" .../>
Any other ideas? I can create a PR.