diff --git a/eleventy.config.js b/eleventy.config.js index 2a68590..4330f48 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -17,6 +17,8 @@ const IMAGE_ATTR_SIZES = [ { minw: null, size: 'calc(100vw - 3rem)' } ]; +const getAttrSizes = ({ minw, size }) => (minw ? `(min-width: ${minw}) ${size}` : size); + const IMAGE_TRANSFORM_OPTS = { widths: [...IMAGE_COMPUTED_WIDTHS, 'auto'], formats: ['avif', 'webp', 'auto'], @@ -27,11 +29,13 @@ const IMAGE_TRANSFORM_OPTS = { defaultAttributes: { loading: 'lazy', decoding: 'async', - sizes: IMAGE_ATTR_SIZES.map(({ minw, size }) => (minw ? `(min-width: ${minw}) ${size}` : size)).join(', ') + sizes: IMAGE_ATTR_SIZES.map(getAttrSizes).join(', ') } }; -const BASE = env.ELEVENTY_PRODUCTION ? 'https://ref-beta.sebin-nyshkim.net' : 'http://localhost:8080'; +const BASE = env.ELEVENTY_PRODUCTION + ? 'https://ref-beta.sebin-nyshkim.net' + : 'http://localhost:8080'; // source: https://notes.jays.net/blog/11ty/ async function getImage(type, src, key) {