@devries-cameron20 / t3code-1 / commits / 8e3aa324b5
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

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

Theo Browne committed Sep 4, 2026 at 07:13 UTC 8e3aa324b57dd645980b203d5f8a5b9f9dc53a84
6 files changed +45 -13
apps/marketing/package.json
+2 -1
@@ -11,7 +11,8 @@
11 },
12 "dependencies": {
13 "@t3tools/shared": "workspace:*",
14 - "astro": "^7.0.3"
14 + "astro": "^7.0.3",
15 + "sharp": "0.34.5"
16 },
17 "devDependencies": {
18 "@astrojs/check": "^0.9.7",
apps/marketing/src/assets/app-desktop.webp renamed
apps/marketing/src/assets/icon.webp renamed
apps/marketing/src/layouts/Layout.astro
+13 -1
@@ -1,4 +1,6 @@
1 ---
2 +import { Image } from "astro:assets";
3 +import appIcon from "../assets/icon.webp";
4 import {
5 ANDROID_PLAY_STORE_URL,
6 GITHUB_REPOSITORY_URL,
@@ -67,7 +69,17 @@ const {
69 <footer class="footer">
70 <div class="footer-inner">
71 <div class="footer-brand">
70 - <img src="/icon.webp" alt="" />
72 + <Image
73 + src={appIcon}
74 + alt=""
75 + width={20}
76 + height={20}
77 + densities={[1, 2, 3]}
78 + format="webp"
79 + quality={90}
80 + loading="lazy"
81 + decoding="async"
82 + />
83 <span>&copy; {new Date().getFullYear()} T3 Tools Inc · MIT licensed</span>
84 </div>
85 <div class="footer-links">
apps/marketing/src/pages/index.astro
+26 -8
@@ -1,4 +1,6 @@
1 ---
2 +import { getImage } from "astro:assets";
3 +import desktopScreenshot from "../assets/app-desktop.webp";
4 import Layout from "../layouts/Layout.astro";
5 import {
6 ANDROID_PLAY_STORE_URL,
@@ -8,6 +10,13 @@ import {
10 } from "../lib/site";
11 import { tweets } from "../lib/tweets";
12
13 +const screenshot = await getImage({
14 + src: desktopScreenshot,
15 + widths: [864, 1180, 1728, 2360],
16 + format: "webp",
17 + quality: 90,
18 +});
19 +
20 const desktopEndorsementRows = [
21 tweets.filter((_, index) => index % 2 === 0),
22 tweets.filter((_, index) => index % 2 === 1),
@@ -80,14 +89,23 @@ const mobileEndorsementRows = [
89 <div data-rise style="--d:520ms">
90 <div class="hero-preview">
91 <figure class="hero-screenshot-frame">
83 - <img
84 - src="/app-desktop.webp"
85 - alt="T3 Code with a settled thread beside its pull request diff"
86 - width="2880"
87 - height="1800"
88 - loading="eager"
89 - decoding="async"
90 - />
92 + <picture>
93 + <!-- Match the hidden mobile layout without requesting a screenshot. -->
94 + <source
95 + media="(max-width: 820px)"
96 + srcset="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
97 + />
98 + <img
99 + src={desktopScreenshot.src}
100 + srcset={`${screenshot.srcSet.attribute}, ${desktopScreenshot.src} ${desktopScreenshot.width}w`}
101 + sizes="(max-width: 960px) min(864px, calc(100vw - 20px)), min(1180px, calc(100vw - 60px))"
102 + alt="T3 Code with a settled thread beside its pull request diff"
103 + width={desktopScreenshot.width}
104 + height={desktopScreenshot.height}
105 + loading="eager"
106 + decoding="async"
107 + />
108 + </picture>
109 </figure>
110 </div>
111 </div>
pnpm-lock.yaml
+4 -3
@@ -206,6 +206,9 @@ importers:
206 astro:
207 specifier: ^7.0.3
208 version: 7.0.3(@astrojs/markdown-remark@7.2.0)(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1)(@types/node@24.12.4)(aws4fetch@1.0.20)(idb-keyval@6.2.1)(ioredis@5.11.0)(jiti@2.7.0)(rollup@4.61.0)(terser@5.48.0)(typescript@6.0.3)(unrun@0.2.39)(yaml@2.9.0)
209 + sharp:
210 + specifier: 0.34.5
211 + version: 0.34.5
212 devDependencies:
213 '@astrojs/check':
214 specifier: ^0.9.7
@@ -12787,8 +12790,7 @@ snapshots:
12790
12791 '@iarna/toml@2.2.5': {}
12792
12790 - '@img/colour@1.1.0':
12791 - optional: true
12793 + '@img/colour@1.1.0': {}
12794
12795 '@img/sharp-darwin-arm64@0.34.5':
12796 optionalDependencies:
@@ -20293,7 +20295,6 @@ snapshots:
20295 '@img/sharp-win32-arm64': 0.34.5
20296 '@img/sharp-win32-ia32': 0.34.5
20297 '@img/sharp-win32-x64': 0.34.5
20296 - optional: true
20298
20299 shebang-command@2.0.0:
20300 dependencies: