Lazy loading images in 11ty/eleventy

1 · Christian · May 11, 2021, 3:22 p.m.
Here I want to show how you can create your own 11ty plugin. Below I’m going to illustrate how to lazy load images using Eleventy plugins. Concept The idea is the following: In your markdown files you can freely use markdown images (via ![alt](img)). In the generated html files, all your images will have the loading=lazy attribute applied so that the browser will lazy load them. The plugin It uses the npm dependency node-html-parser (install it via npm i -D node-html-parser) The plugin can be ea...