feat: 🔧 add compressor config options

This commit is contained in:
Sebin Nyshkim 2024-10-22 12:51:18 +02:00
parent 929d9cf8a4
commit 796619d22b

View file

@ -70,6 +70,8 @@ export default async function (eleventyConfig) {
extensions: 'html', extensions: 'html',
formats: ['avif', 'webp', 'auto'], formats: ['avif', 'webp', 'auto'],
widths: [640, 800, 1280, 1920, 2560, 3840, 'auto'], widths: [640, 800, 1280, 1920, 2560, 3840, 'auto'],
sharpJpegOptions: { mozjpeg: true, optimiseScans: true, quality: 95 },
sharpPngOptions: { compressionLevel: 9 },
urlPath: '/img/', urlPath: '/img/',
outputDir: './public/img/', outputDir: './public/img/',
defaultAttributes: { defaultAttributes: {
@ -112,6 +114,8 @@ export default async function (eleventyConfig) {
eleventyConfig.addShortcode('bgimgset', async (src) => { eleventyConfig.addShortcode('bgimgset', async (src) => {
const imgset = await Image(src, { const imgset = await Image(src, {
widths: [1920, 2560, 3840], widths: [1920, 2560, 3840],
sharpJpegOptions: { mozjpeg: true, optimiseScans: true, quality: 95 },
sharpPngOptions: { compressionLevel: 9 },
formats: ['avif', 'webp', 'auto'], formats: ['avif', 'webp', 'auto'],
urlPath: '/img/', urlPath: '/img/',
outputDir: './public/img/' outputDir: './public/img/'