11ty / eleventy-img

Utility to perform build-time image transformations.

Home Page:https://www.11ty.dev/docs/plugins/image/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

More clearly document svgShortCircuit

joshproehl opened this issue · comments

Having read https://www.11ty.dev/docs/plugins/image/#skip-raster-formats-for-svg, as well as the "expand to see the full list of options (defaults shown)" example of

// skip raster formats if SVG available
svgShortCircuit: false,

I believed I understood that setting svgShortCircuit:false (default) would cause eleventy-img to not convert my SVG's to raster images.

This appears to be the opposite in practice, and as soon as I set svgShortCircuit:true, I get the desired behavior of my SVG file being copied directly, and no webp version being created.

If my understanding is correct, then perhaps the wording of the example could be changed to something like:

// set to true to skip outputting rasterized formats if using SVG source file
svgShortCircuit: false

and the text in the https://www.11ty.dev/docs/plugins/image/#skip-raster-formats-for-svg section to:

If using SVG output (svg is added to your formats array) and providing an SVG source file, setting this to true will skip all of the raster formats, even if they're in formats, and only output an SVG file.

plus the additional text about CMS-driven workflows, which I have not rewritten as I don't quite understand what its meaning is.

Would welcome a PR for this!

Also I would note this blog post which documents some of this as well (I’ve cross linked from the Image docs too)

https://www.zachleat.com/web/svg-short-circuit/