You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will greatly improve development speed during --serve (for projects that don’t have processed images on disk, already pretty fast using the existing disk cache).
If you aren’t using those methods, you can manually opt-in using the transformOnRequest option and the eleventyImageOnRequestDuringServePlugin plugin:
constImage=require("@11ty/eleventy-img");const{ eleventyImageOnRequestDuringServePlugin }=require("@11ty/eleventy-img");module.exports=function(eleventyConfig){eleventyConfig.addShortcode("image",asyncfunction(src,alt){letmetadata=awaitImage(src,{transformOnRequest: process.env.ELEVENTY_RUN_MODE==="serve",});letimageAttributes={
alt,};// You bet we throw an error on a missing alt (alt="" works okay)returnImage.generateHTML(metadata,imageAttributes);});// Serve images on requesteleventyConfig.addPlugin(eleventyImageOnRequestDuringServePlugin);};
Making use of the new
onRequest
Dev Server feature: https://www.11ty.dev/docs/dev-server/#onrequest-for-request-time-processingThis will greatly improve development speed during
--serve
(for projects that don’t have processed images on disk, already pretty fast using the existing disk cache).https://www.11ty.dev/docs/plugins/image/#disk-cache
The text was updated successfully, but these errors were encountered: