diff --git a/landing-astro/astro.config.mjs b/landing-astro/astro.config.mjs index 53e4cde..5f040c8 100644 --- a/landing-astro/astro.config.mjs +++ b/landing-astro/astro.config.mjs @@ -3,6 +3,7 @@ import { defineConfig } from 'astro/config'; import sitemap from '@astrojs/sitemap'; import react from '@astrojs/react'; import tailwindcss from '@tailwindcss/vite'; +import { readFile, writeFile } from 'node:fs/promises'; // Mirrors fleet/sarthakagrawal/astro.config.mjs, the reference 360 ms-LCP // Astro setup. Pure static output (no SSR adapter) — the rolepatch.com @@ -22,7 +23,25 @@ export default defineConfig({ build: { format: 'file', }, - integrations: [sitemap(), react()], + integrations: [sitemap(), react(), { + name: 'responsive-hero', + hooks: { + 'astro:build:done': async ({ dir }) => { + // The shared Workbench template has no srcset passthrough. Add only + // delivery attributes to its static hero; keep its markup and styling. + const page = new URL('index.html', dir); + const html = await readFile(page, 'utf8'); + const hero = /]*\bsrc="\/images\/patch-stage\.webp"[^>]*>/g; + if ([...html.matchAll(hero)].length !== 1) { + throw new Error('Expected exactly one Workbench hero image'); + } + await writeFile(page, html.replace(hero, (tag) => tag.replace( + 'src="/images/patch-stage.webp"', + 'src="/images/patch-stage.webp" srcset="/images/patch-stage-400.webp 400w, /images/patch-stage-700.webp 700w, /images/patch-stage-1000.webp 1000w, /images/patch-stage.webp 1400w" sizes="(max-width: 639px) calc(100vw - clamp(32px, 16px + 5vw, 80px) - 34px), (max-width: 1023px) calc(100vw - clamp(32px, 16px + 5vw, 80px) - 82px), calc(min(100vw, 1216px) - clamp(32px, 16px + 5vw, 80px) - 114px)"', + ))); + }, + }, + }], vite: { plugins: [tailwindcss()], css: { transformer: 'lightningcss' }, diff --git a/landing-astro/public/images/patch-stage-1000.webp b/landing-astro/public/images/patch-stage-1000.webp new file mode 100644 index 0000000..92ad888 Binary files /dev/null and b/landing-astro/public/images/patch-stage-1000.webp differ diff --git a/landing-astro/public/images/patch-stage-400.webp b/landing-astro/public/images/patch-stage-400.webp new file mode 100644 index 0000000..6eab661 Binary files /dev/null and b/landing-astro/public/images/patch-stage-400.webp differ diff --git a/landing-astro/public/images/patch-stage-700.webp b/landing-astro/public/images/patch-stage-700.webp new file mode 100644 index 0000000..bfa6075 Binary files /dev/null and b/landing-astro/public/images/patch-stage-700.webp differ diff --git a/landing-astro/src/pages/index.astro b/landing-astro/src/pages/index.astro index d46f382..a939591 100644 --- a/landing-astro/src/pages/index.astro +++ b/landing-astro/src/pages/index.astro @@ -48,11 +48,7 @@ content.page.jsonLd = [jsonLd, { data-vitals-routes="changelog,docs,faq" > diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 3d3c3d5..f586cf5 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -124,7 +124,7 @@ export default function RootLayout({ {/* Microsoft Clarity — session replay + heatmaps (additive; PostHog stays) */}