use eleventyImageTransformPlugin

This commit is contained in:
madrilene 2025-01-09 14:01:01 +01:00
parent fa753b52e7
commit 5fce1c2cb2
2 changed files with 18 additions and 1 deletions

View file

@ -54,6 +54,21 @@ export default async function (eleventyConfig) {
useTransform: true
});
eleventyConfig.addPlugin(plugins.eleventyImageTransformPlugin, {
formats: ['avif', 'webp', 'jpeg'],
outputDir: '/assets/images/',
widths: ['auto'],
extensions: 'html',
htmlOptions: {
imgAttributes: {
loading: 'lazy',
decoding: 'async',
sizes: '100vw'
},
pictureAttributes: {}
}
});
// --------------------- bundle
eleventyConfig.addBundle('css', {hoist: true});

View file

@ -3,6 +3,7 @@ import {EleventyRenderPlugin} from '@11ty/eleventy';
import rss from '@11ty/eleventy-plugin-rss';
import syntaxHighlight from '@11ty/eleventy-plugin-syntaxhighlight';
import webc from '@11ty/eleventy-plugin-webc';
import {eleventyImageTransformPlugin} from '@11ty/eleventy-img';
// custom
import {markdownLib} from './plugins/markdown.js';
@ -20,8 +21,9 @@ export default {
rss,
syntaxHighlight,
webc,
eleventyImageTransformPlugin,
markdownLib,
drafts,
drafts,
htmlConfig,
cssConfig,
jsConfig