xmitter-11ty/eleventy.config.images.js

29 lines
922 B
JavaScript
Raw Normal View History

2024-02-12 10:19:19 -05:00
import { eleventyImageTransformPlugin } from "@11ty/eleventy-img";
2023-01-24 09:08:52 -05:00
2024-02-12 10:19:19 -05:00
export default function(eleventyConfig) {
eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
// which file extensions to process
extensions: "html",
2024-02-12 10:19:19 -05:00
formats: ["avif", "webp", "auto"],
2024-02-12 10:19:19 -05:00
// widths: ["auto"],
2023-01-24 09:08:52 -05:00
2024-02-12 10:19:19 -05:00
// urlPath: "/img/",
2023-01-24 09:08:52 -05:00
2024-02-12 10:19:19 -05:00
// If a urlPath is not specified:
2024-02-12 10:19:19 -05:00
// 1. Relative image sources (<img src="./possum.png">) will be co-located in your output directory
// with the template they are used in. Warning: if the same source image is used in multiple templates,
// it will be written to two different locations!
// 2. Absolute image sources (<img src="/possum.png">) will be normalized to your input/content directory
// and written to ${OUTPUT_DIR}/img/
2023-01-24 09:41:50 -05:00
2024-02-12 10:19:19 -05:00
// <img loading decoding> assigned on the HTML tag will override these values.
defaultAttributes: {
2023-01-24 09:08:52 -05:00
loading: "lazy",
2024-02-12 10:19:19 -05:00
decoding: "async"
}
2023-01-24 09:08:52 -05:00
});
};