perf(marketing): serve images at their display size (#9682)

This commit is contained in:
Theo Browne authored and GitHub committed 2026-09-04 07:13:22 -07:00
1 parent 7cf5b284e6
commit 8e3aa324b5
6 files changed
+45 -13

No files matched your search

+2 -1
View File
@@ -11,7 +11,8 @@
},
"dependencies": {
"@t3tools/shared": "workspace:*",
"astro": "^7.0.3"
"astro": "^7.0.3",
"sharp": "0.34.5"
},
"devDependencies": {
"@astrojs/check": "^0.9.7",
File renamed without changes.

Before

Width:  |  Height:  |  Size: 262 KiB

After

Width:  |  Height:  |  Size: 262 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

+13 -1
View File
@@ -1,4 +1,6 @@
---
import { Image } from "astro:assets";
import appIcon from "../assets/icon.webp";
import {
ANDROID_PLAY_STORE_URL,
GITHUB_REPOSITORY_URL,
@@ -67,7 +69,17 @@ const {
<footer class="footer">
<div class="footer-inner">
<div class="footer-brand">
<img src="/icon.webp" alt="" />
<Image
src={appIcon}
alt=""
width={20}
height={20}
densities={[1, 2, 3]}
format="webp"
quality={90}
loading="lazy"
decoding="async"
/>
<span>&copy; {new Date().getFullYear()} T3 Tools Inc · MIT licensed</span>
</div>
<div class="footer-links">
+26 -8
View File
@@ -1,4 +1,6 @@
---
import { getImage } from "astro:assets";
import desktopScreenshot from "../assets/app-desktop.webp";
import Layout from "../layouts/Layout.astro";
import {
ANDROID_PLAY_STORE_URL,
@@ -8,6 +10,13 @@ import {
} from "../lib/site";
import { tweets } from "../lib/tweets";
const screenshot = await getImage({
src: desktopScreenshot,
widths: [864, 1180, 1728, 2360],
format: "webp",
quality: 90,
});
const desktopEndorsementRows = [
tweets.filter((_, index) => index % 2 === 0),
tweets.filter((_, index) => index % 2 === 1),
@@ -80,14 +89,23 @@ const mobileEndorsementRows = [
<div data-rise style="--d:520ms">
<div class="hero-preview">
<figure class="hero-screenshot-frame">
<img
src="/app-desktop.webp"
alt="T3 Code with a settled thread beside its pull request diff"
width="2880"
height="1800"
loading="eager"
decoding="async"
/>
<picture>
<!-- Match the hidden mobile layout without requesting a screenshot. -->
<source
media="(max-width: 820px)"
srcset="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
/>
<img
src={desktopScreenshot.src}
srcset={`${screenshot.srcSet.attribute}, ${desktopScreenshot.src} ${desktopScreenshot.width}w`}
sizes="(max-width: 960px) min(864px, calc(100vw - 20px)), min(1180px, calc(100vw - 60px))"
alt="T3 Code with a settled thread beside its pull request diff"
width={desktopScreenshot.width}
height={desktopScreenshot.height}
loading="eager"
decoding="async"
/>
</picture>
</figure>
</div>
</div>
+4 -3
View File
@@ -206,6 +206,9 @@ importers:
astro:
specifier: ^7.0.3
version: 7.0.3(@astrojs/[email protected])(@emnapi/[email protected])(@emnapi/[email protected])(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])
sharp:
specifier: 0.34.5
version: 0.34.5
devDependencies:
'@astrojs/check':
specifier: ^0.9.7
@@ -12787,8 +12790,7 @@ snapshots:
'@iarna/[email protected]': {}
'@img/[email protected]':
optional: true
'@img/[email protected]': {}
'@img/[email protected]':
optionalDependencies:
@@ -20293,7 +20295,6 @@ snapshots:
'@img/sharp-win32-arm64': 0.34.5
'@img/sharp-win32-ia32': 0.34.5
'@img/sharp-win32-x64': 0.34.5
optional: true
[email protected]:
dependencies: