Skip to main content

Module image_plugin

Module image_plugin 

Source
Expand description

Image optimization with WebP and responsive srcset. Image optimization plugin.

Processes images to generate WebP variants and responsive <picture> elements with srcset, loading="lazy", and decoding="async".

§Responsive pipeline

For each <img> in compiled HTML the plugin emits:

<picture>
  <source type="image/avif" srcset="…-320w.avif 320w, …"> <!-- if avif feature -->
  <source type="image/webp" srcset="…-320w.webp 320w, …">
  <img src="/original.jpg" alt="…" width="…" height="…"
       loading="lazy" decoding="async">
</picture>

Images tagged with fetchpriority="high" receive loading="eager" instead, so the browser fetches them immediately.

Structs§

ImageOptimizationPlugin
Plugin that optimises images and rewrites HTML with <picture> tags.