Skip to content

Hellogramming/imdexer-eleventy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

imdexer-eleventy

An Eleventy plugin that generates optimized, responsive <img> tags using imdexer JSON data, configured by zone (local, CDN, etc.). Automatically sets srcset, sizes, width, and height to prevent layout shifts (CLS).

Handling responsive images in web development can be a complex and tedious task. You need to generate multiple image sizes, write intricate srcset and sizes attributes, and ensure images are served efficiently to prevent Cumulative Layout Shift (CLS) - a frustrating user experience where elements move around after the page has initially loaded. This is especially true in static site generators like Eleventy, where you might manage images from various sources, like a local folder or a CDN.

The imdexer-eleventy plugin simplifies this process by automatically generating responsive <img> tags for your Eleventy site. It leverages the power of imdexer, a tool that creates an index of your images and their different sizes. By providing this index to imdexer-eleventy, along with a simple configuration, the plugin intelligently constructs the <img> tags with all the necessary attributes for optimal image delivery. The plugin uses the image metadata from imdexer to add the width and height attributes to the <img> tag, preventing CLS.

Using imdexer-eleventy offers several key benefits. First, it significantly improves your website's performance by ensuring that the browser can download the most appropriate image size for each user's viewport. Second, it enhances the user experience by eliminating layout shifts caused by images loading without specified dimensions. Finally, it streamlines your development workflow by automating the complex task of responsive image management, allowing you to focus on creating great content.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published