static-site-scaffold-modules icon indicating copy to clipboard operation
static-site-scaffold-modules copied to clipboard

[eleventy-plugin-local-respimg] Right way to exclude certain images or files

Open saneef opened this issue 4 years ago • 1 comments

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 have srcset attribute 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?

saneef avatar Jul 09 '21 04:07 saneef

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.

saneef avatar Jul 09 '21 04:07 saneef