Skip to content

perf(landing): responsive screenshot variants and 30-day cache headers - #238

Merged
gnacho merged 1 commit into
mainfrom
fix/237-assets-cache
Oct 29, 2026
Merged

gnacho merged 1 commit into
mainfrom
fix/237-assets-cache

Conversation

@gnacho

@gnacho gnacho commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Problem

Lighthouse mobile on production scored 100 but left two audits at zero:

  • uses-responsive-images 0 and image-delivery-insight 0: every visitor downloaded a 1800x1200 screenshot (~15.7 KB) for a box of 312 to 940 px, and the thumbnails did the same for a 72 px square.
  • cache-insight 0: js and css were cached for one hour, og.png for seven days, and images had no cache header at all.

Changes

  • landing/app.js: a shot() factory builds each slide with src (960), a srcset of 320/640/960/1080/1800 and a thumb (320). The lightbox always opens the 1800 original instead of copying whatever the slider had loaded.
  • landing/index.html: srcset and sizes on the slider image, cache-bust to app.js?v=11.
  • landing/assets/shots/: 16 WebP variants (4 screenshots x 320/640/960/1080), generated with ImageMagick at quality 82.
  • nginx vhost (webs2, backup .bak-cache-20261029, nginx -t and hot reload): js and css from 1h to 30 days, og.png from 7d to 30 days, and a new rule giving images 30 days.

Verification

  • New Playwright suite verify-nxs-srcset.js: 30/30 against production. The chosen variant matches the box at 360 dpr2, 390 dpr3 and 1280 dpr1, thumbnails load the 320 file, the lightbox opens the 1800 original, no overflow, no console errors.
  • Previous suites: 233 checks, 0 failures. axe: 0 violations at 360/390/1280.
  • Lighthouse mobile after the change: performance 99, accessibility 100, best practices 100, SEO 100. Total weight 94 to 87 KiB. uses-responsive-images, image-delivery-insight and cache-insight now pass.
  • LCP goes from 1.8s to 2.0s, measured as TTFB 84 ms plus 947 ms of render delay from blocking CSS and the font swap, not weight. Still below the 2.5s threshold.
  • uses-long-cache-ttl stays at 0.5 on purpose: Lighthouse rewards a one-year TTL, and screenshots change with each release, so 30 days is the deliberate choice.

Already deployed to https://nextsync.cloudless.club/ and verified there.

Closes #237

@gnacho
gnacho merged commit a68ff65 into main Oct 29, 2026
2 checks passed
@gnacho
gnacho deleted the fix/237-assets-cache branch October 29, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

landing: oversized screenshots and missing cache headers

1 participant