feat: 🏗️ improve global responsive image defaults
This commit is contained in:
parent
db32cb2ee1
commit
f48dc3e7ee
7 changed files with 15 additions and 15 deletions
|
@ -6,7 +6,19 @@ import htmlminifier from 'html-minifier-terser';
|
||||||
import markdownIt from 'markdown-it';
|
import markdownIt from 'markdown-it';
|
||||||
|
|
||||||
const MARKDOWNIT_OPTIONS = { html: true, linkify: true, typographer: true };
|
const MARKDOWNIT_OPTIONS = { html: true, linkify: true, typographer: true };
|
||||||
|
|
||||||
|
const IMAGE_BASE_WIDTHS = [500, 750, 1000];
|
||||||
|
const IMAGE_COMPUTED_WIDTHS = new Set(IMAGE_BASE_WIDTHS.flatMap((w) => [w * 1, w * 2, w * 3]));
|
||||||
|
const IMAGE_ATTR_SIZES = [
|
||||||
|
{ minw: '120em', size: '1000px' },
|
||||||
|
{ minw: '64em', size: '750px' },
|
||||||
|
{ minw: '40em', size: '700px' },
|
||||||
|
{ minw: '35em', size: '500px' },
|
||||||
|
{ minw: null, size: 'calc(100vw - 3rem)' }
|
||||||
|
];
|
||||||
|
|
||||||
const IMAGE_TRANSFORM_OPTS = {
|
const IMAGE_TRANSFORM_OPTS = {
|
||||||
|
widths: [...IMAGE_COMPUTED_WIDTHS, 'auto'],
|
||||||
formats: ['avif', 'webp', 'auto'],
|
formats: ['avif', 'webp', 'auto'],
|
||||||
sharpJpegOptions: { mozjpeg: true, optimiseScans: true, quality: 95 },
|
sharpJpegOptions: { mozjpeg: true, optimiseScans: true, quality: 95 },
|
||||||
sharpPngOptions: { compressionLevel: 9 },
|
sharpPngOptions: { compressionLevel: 9 },
|
||||||
|
@ -15,7 +27,7 @@ const IMAGE_TRANSFORM_OPTS = {
|
||||||
defaultAttributes: {
|
defaultAttributes: {
|
||||||
loading: 'lazy',
|
loading: 'lazy',
|
||||||
decoding: 'async',
|
decoding: 'async',
|
||||||
sizes: '(min-width: 64em) 500px, (min-width: 50em) 420px, 375px'
|
sizes: IMAGE_ATTR_SIZES.map(({ minw, size }) => (minw ? `(min-width: ${minw}): ${size}` : size))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,16 +4,12 @@
|
||||||
:class="(dropshadow ? 'dropshadow' : '')"
|
:class="(dropshadow ? 'dropshadow' : '')"
|
||||||
:src="`src/img/${char}/${src}`"
|
:src="`src/img/${char}/${src}`"
|
||||||
:alt="`${alt} by ${artist}`"
|
:alt="`${alt} by ${artist}`"
|
||||||
:width="width"
|
|
||||||
sizes="1000px"
|
|
||||||
></eleventy-image>
|
></eleventy-image>
|
||||||
<eleventy-image
|
<eleventy-image
|
||||||
class="image nsfw"
|
class="image nsfw"
|
||||||
:class="(dropshadow ? 'dropshadow' : '')"
|
:class="(dropshadow ? 'dropshadow' : '')"
|
||||||
:src="`src/img/${char}/${src.replace(/^(.*?)(\.[^.]+)$/, '$1-nsfw$2')}`"
|
:src="`src/img/${char}/${src.replace(/^(.*?)(\.[^.]+)$/, '$1-nsfw$2')}`"
|
||||||
:alt="`${alt} by ${artist}`"
|
:alt="`${alt} by ${artist}`"
|
||||||
:width="width"
|
|
||||||
sizes="1000px"
|
|
||||||
webc:if="nsfw"
|
webc:if="nsfw"
|
||||||
></eleventy-image>
|
></eleventy-image>
|
||||||
<figcaption class="caption">
|
<figcaption class="caption">
|
||||||
|
|
|
@ -9,7 +9,6 @@ eleventyNavigation:
|
||||||
:@alt="'Jarek Ref'"
|
:@alt="'Jarek Ref'"
|
||||||
:@artist="'Alpha Moonlight'"
|
:@artist="'Alpha Moonlight'"
|
||||||
:@href="'https://bsky.app/profile/alphamoonlight.bsky.social'"
|
:@href="'https://bsky.app/profile/alphamoonlight.bsky.social'"
|
||||||
:@width="[1000]"
|
|
||||||
:@char="$data.firstName.toLowerCase()"
|
:@char="$data.firstName.toLowerCase()"
|
||||||
:@dropshadow="true"
|
:@dropshadow="true"
|
||||||
:@nsfw="true"
|
:@nsfw="true"
|
||||||
|
|
|
@ -19,7 +19,8 @@ feedbackLink: https://cloud.sebin-nyshkim.net/apps/forms/s/eHjsosE9FB4fCpjBt4mbP
|
||||||
slot="avatar"
|
slot="avatar"
|
||||||
:src="`src/img/${firstName.toLowerCase()}/avatar.png`"
|
:src="`src/img/${firstName.toLowerCase()}/avatar.png`"
|
||||||
:alt="firstName + ' Avatar'"
|
:alt="firstName + ' Avatar'"
|
||||||
:width="[500, 1000]"
|
:width="[100, 200, 300, 400, 500, 600]"
|
||||||
|
sizes="(min-width: 120em) 250px, (min-width: 64em) 200px, 100px"
|
||||||
></eleventy-image>
|
></eleventy-image>
|
||||||
<template webc:nokeep slot="name" @text="fullName"></template>
|
<template webc:nokeep slot="name" @text="fullName"></template>
|
||||||
<template webc:nokeep slot="species" @text="species"></template>
|
<template webc:nokeep slot="species" @text="species"></template>
|
||||||
|
|
|
@ -9,7 +9,6 @@ eleventyNavigation:
|
||||||
:@alt="`Sebin Ref`"
|
:@alt="`Sebin Ref`"
|
||||||
:@artist="`draftgon`"
|
:@artist="`draftgon`"
|
||||||
:@href="`https://bsky.app/profile/draftgon.bsky.social`"
|
:@href="`https://bsky.app/profile/draftgon.bsky.social`"
|
||||||
:@width="[1000]"
|
|
||||||
:@char="$data.firstName.toLowerCase()"
|
:@char="$data.firstName.toLowerCase()"
|
||||||
:@dropshadow="true"
|
:@dropshadow="true"
|
||||||
:@nsfw="true"
|
:@nsfw="true"
|
||||||
|
@ -38,7 +37,6 @@ Sebin has a muscular build that he keeps in shape with regular exercise, which h
|
||||||
:@alt="`Sebin Ref`"
|
:@alt="`Sebin Ref`"
|
||||||
:@artist="`draftgon`"
|
:@artist="`draftgon`"
|
||||||
:@href="`https://bsky.app/profile/draftgon.bsky.social`"
|
:@href="`https://bsky.app/profile/draftgon.bsky.social`"
|
||||||
:@width="[1000]"
|
|
||||||
:@char="$data.firstName.toLowerCase()"
|
:@char="$data.firstName.toLowerCase()"
|
||||||
:@dropshadow="true"
|
:@dropshadow="true"
|
||||||
:@nsfw="true"
|
:@nsfw="true"
|
||||||
|
@ -61,7 +59,6 @@ While Sebin's wings can carry him short to medium distances, there are limitatio
|
||||||
:@alt="`Sebin's expressions`"
|
:@alt="`Sebin's expressions`"
|
||||||
:@artist="`draftgon`"
|
:@artist="`draftgon`"
|
||||||
:@href="`https://bsky.app/profile/draftgon.bsky.social`"
|
:@href="`https://bsky.app/profile/draftgon.bsky.social`"
|
||||||
:@width="[1000]"
|
|
||||||
:@char="$data.firstName.toLowerCase()"
|
:@char="$data.firstName.toLowerCase()"
|
||||||
:@dropshadow="true"
|
:@dropshadow="true"
|
||||||
></ref-img>
|
></ref-img>
|
||||||
|
@ -87,7 +84,6 @@ When threatened or enraged, Sebin can unleash a stream of fire from his mouth, w
|
||||||
:@alt="`Sebin's upper body closeup`"
|
:@alt="`Sebin's upper body closeup`"
|
||||||
:@artist="`Nidhogg`"
|
:@artist="`Nidhogg`"
|
||||||
:@href="`https://bsky.app/profile/nidthedragon.bsky.social`"
|
:@href="`https://bsky.app/profile/nidthedragon.bsky.social`"
|
||||||
:@width="[1000]"
|
|
||||||
:@char="$data.firstName.toLowerCase()"
|
:@char="$data.firstName.toLowerCase()"
|
||||||
:@dropshadow="true"
|
:@dropshadow="true"
|
||||||
></ref-img>
|
></ref-img>
|
||||||
|
@ -108,7 +104,6 @@ Sebin's drawn muscle anatomy can vary quite a bit. It can range from athletic to
|
||||||
<ref-img webc:for="ref of [...Array(9).keys()]"
|
<ref-img webc:for="ref of [...Array(9).keys()]"
|
||||||
:@src="`ref-muscle-${ref + 1}.png`"
|
:@src="`ref-muscle-${ref + 1}.png`"
|
||||||
:@alt="$data.galleryMuscle[ref].alt"
|
:@alt="$data.galleryMuscle[ref].alt"
|
||||||
:@width="[500, 1000]"
|
|
||||||
:@href="$data.galleryMuscle[ref].href"
|
:@href="$data.galleryMuscle[ref].href"
|
||||||
:@artist="$data.galleryMuscle[ref].artist"
|
:@artist="$data.galleryMuscle[ref].artist"
|
||||||
:@char="$data.firstName.toLowerCase()"
|
:@char="$data.firstName.toLowerCase()"
|
||||||
|
@ -131,7 +126,6 @@ There's still one piece of anatomy you *haven't* seen yet! 👀💦
|
||||||
:@alt="`Sebin's manly parts`"
|
:@alt="`Sebin's manly parts`"
|
||||||
:@artist="`draftgon`"
|
:@artist="`draftgon`"
|
||||||
:@href="`https://bsky.app/profile/draftgon.bsky.social`"
|
:@href="`https://bsky.app/profile/draftgon.bsky.social`"
|
||||||
:@width="[500, 1000]"
|
|
||||||
:@char="$data.firstName.toLowerCase()"
|
:@char="$data.firstName.toLowerCase()"
|
||||||
:@dropshadow="true"
|
:@dropshadow="true"
|
||||||
></ref-img>
|
></ref-img>
|
||||||
|
|
|
@ -11,7 +11,6 @@ Sebin knows how to dress!
|
||||||
:@src="`ref-clothes-${ref + 1}.png`"
|
:@src="`ref-clothes-${ref + 1}.png`"
|
||||||
:@alt="$data.galleryClothing[ref].alt"
|
:@alt="$data.galleryClothing[ref].alt"
|
||||||
:@href="$data.galleryClothing[ref].href"
|
:@href="$data.galleryClothing[ref].href"
|
||||||
:@width="[500, 1000]"
|
|
||||||
:@char="$data.firstName.toLowerCase()"
|
:@char="$data.firstName.toLowerCase()"
|
||||||
:@artist="$data.galleryClothing[ref].artist"
|
:@artist="$data.galleryClothing[ref].artist"
|
||||||
:@dropshadow="false"
|
:@dropshadow="false"
|
||||||
|
|
|
@ -46,7 +46,6 @@ He needed answers. If he ever were to tap into this power again, he feared he co
|
||||||
:@alt="`Sebin Overdrive Ref`"
|
:@alt="`Sebin Overdrive Ref`"
|
||||||
:@artist="`CVictorrosso`"
|
:@artist="`CVictorrosso`"
|
||||||
:@href="`https://bsky.app/profile/cvictorrosso.bsky.social`"
|
:@href="`https://bsky.app/profile/cvictorrosso.bsky.social`"
|
||||||
:@width="[1000]"
|
|
||||||
:@char="$data.firstName.toLowerCase()"
|
:@char="$data.firstName.toLowerCase()"
|
||||||
:@dropshadow="false"
|
:@dropshadow="false"
|
||||||
></ref-img>
|
></ref-img>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue