Eleventy Image v6.0.0
Notably, for maximum compatibility this package is still CommonJS (not yet ESM). Node minimum is still 18+ (unchanged from Eleventy Image v4).
Breaking Changes
useCacheValidityInHashoption has been removed #146- Transform method will reuse existing
<img width>attribute (if single integer) aseleventy:widthsvalue #234
The following changes likely require no action on your part (but are nonetheless breaking):
- Better color support (P3, AdobeRGB, et al): images retain ICC profiles by default #244
- Dependency major upgrade:
@11ty/eleventy-fetchfrom v4 to v5 - Dependency major upgrade
@11ty/eleventy-utilsfrom v1 to v2 - Default metadata object returned will no longer include empty format arrays
{ jpeg: [] }#242
Features
- Uses native
fetch()(no morenode-fetch, viaeleventy-fetchupgrade) and works better with caching on remote urls, consistency on file names with sync methods #252 #262 #146 returnType: "html"option will return the generated HTML directly instead of the metadata object #267htmlOptions: {}are options passed to thegenerateHTMLfunction
- Output format filtering (opt-out with
formatFilteringoption). Filters out output formats that do not support animation or transparency automatically. - Adds
failOnError: trueoption to avoid throwing an error when image processing fails (and failing your build) #225 See also theeleventy:optionalattribute below. - Adds new
transformhook for running your ownsharpcustomizations #52 (comment) (can be used to add custom cropping!) - Improved error messaging when incorrectly using the default export with
eleventyConfig.addPlugin#263 - Concurrency auto-scales per machine resources (between
8min and16max) #258 - Support full URLs in
urlPathoption #239 generateHTML: Missingsizeserror relaxed when usingloading="lazy"HTML, swap to usesizes="auto"instead #207- New
generateHTMLoption (also available viahtmlOptions) forfallback: "smallest"to choose smallest image for<img>fallback andwidth/heightdimensions #265 #129
Transform Method
- Reuse existing
<img width>attribute (if single integer) aseleventy:widthsvalue #234 - Adds
eleventy:optionalHTML attribute so that errors in image processing will not fail the build (in different ways) #259- Remove
srcattribute - Leave as-is
eleventy:optional="keep" - Replace with a transparent Data URI
eleventy:optional="placeholder"
- Remove
- Decode file name paths #253
- Support transforming
<picture>nodes #214 - Preserve attributes on
imgandpictureelements #214 (comment) #241 #243 #251 - Fix for relative references when using permalinks with non-index.html file names #236
Full Milestone (×26 issues closed): https://github.com/11ty/eleventy-img/milestone/22?closed=1
Full Changelog (×75 commits, +2,347/-992): v5.0.0...v6.0.0