Repository navigation
Description
Summary
Most images Tale ships exist in exactly one dimension. The clearest case is the docs screenshots: services/docs/public/images/ holds 82 WebP files (about 6.8 MB), 45 of them 2880×1800 (a DPR 2 capture of a 1440×900 viewport), and every page references that one file with plain markdown, for example . A phone, a laptop and a retina desktop all download the same bitmap, and the browser is never told its size. The marketing site already solved this for its own images; the docs, the design-system docs, the README and the social cards did not take it up.
This issue is to give every place that shows an image the dimension or dimensions it needs, from one shared implementation.
Current behavior
Verified in the repository:
- One size per docs screenshot.
services/docs/public/images/manifest.jsonhas 82 entries: 45 at 2880×1800, three at 4480×2800, three at 2048×1700, and the rest vary by shot. Each shot is one file. The German and French trees (public/images/platform/de,…/fr) hold 8 shots each, again one file apiece. - The only contract is a ceiling.
services/docs/tests/image-manifest.test.tsrequires width ≤ 2880 and even (the DPR 2 contract), that every file is in the manifest, and that every file is referenced. Nothing asks for a smaller variant. - Rendered as a bare
<img>. The shared markdown renderer'sImageZoom(packages/ui/src/markdown/components/image-zoom.tsx:43-49) emitssrc,alt,loading="lazy"anddecoding="async": nosrcset, nosizes, nowidth/height. The browser cannot pick a smaller file, and the layout shifts as each image arrives. The zoom lightbox loads the same file. - Captured at one viewport.
services/platform/tests/docs-screenshots/capture.ts:119takesshot.viewport ?? VIEWPORT, so a shot is one page at one size; there is no notion of the same page captured for phone and desktop. - Every other place is its own thing. The README tiles are straight downscales of the docs shots (
bun run readme:assets,services/platform/tests/docs-screenshots/readme-assets.ts, output.github/assets/readme-*.webp). The ui-docs site ships a singlepublic/og.png; social-image tags come frompackages/ui/src/seo/document-meta.ts. The platform does no server-side image resizing (sharpappears only in capture and test tooling).
The repository already has the pattern, in one place only:
services/web/scripts/optimize-images.tsemits AVIF and WebP at 480 / 828 / 1200 / 1600 / 2400 / 2880 px plus a blur preview, within a 200 KiB budget, intoapp/generated/image-manifest.ts.services/web/app/components/blocks/product-screenshot.tsx:222renders a<picture>with a separate phone crop (media="(max-width: 639px)"),srcSet,sizesand explicitwidth/height.- The
@tale/uiImageprimitive (packages/ui/src/components/primitives/image.tsx) already passessrcSet,sizes, dimensions and a blur placeholder through.
Proposed change
Two parts that share one manifest. Part 2 can follow part 1.
- Deliver the right size. One width ladder and format policy (AVIF + WebP) for every captured image, generated from the capture, with the existing
/images/<section>/<shot>.webppath kept as the full-size file. The shared markdown image component renderssrcset,sizesand the intrinsicwidth/heightfrom the manifest, so a phone fetches a phone-sized file and the layout is reserved before the image loads. The lightbox keeps loading the largest. - Capture the right dimension. Let a shot be captured at more than one viewport (phone, tablet, desktop) where the page differs, recorded as variants of the same shot in the manifest, and let a page pick the matching one (
<picture media>, as the marketing site does) instead of one desktop screenshot scaled down. README tiles and social cards (for example 1200×630) come out of the same pipeline, not by hand.
One implementation, not two: the docs and the marketing site should share the encoder, the manifest shape and the image component rather than the docs growing a copy of optimize-images.ts. Decide where the shared piece lives (@tale/ui for the component; the encoder wherever both services can import it).
All places to cover
- Docs screenshots: EN, DE and FR trees
- ui-docs: social image and any inline images
- Marketing site: confirm it meets the same budget and rules; it is the reference
- README gallery and tour (
.github/assets/) - Social/OG images for docs, ui-docs and web
- In-app images (chat attachments, the document preview, branding logos): no thumbnails are generated today, so check what each loads and at what size
Acceptance criteria
- A written ladder, format policy and per-variant byte budget, enforced by a test (extend
image-manifest.test.ts: every variant exists, is referenced, sits on the ladder and matches its file header; no orphans). - Every docs image renders with
srcset,sizesandwidth/height; no layout shift as images load. - The existing
/images/…URLs keep answering as the full-size file (the README and external pages link them). - Shots whose layout differs by device have phone and desktop captures; list which ones in the PR.
- Before/after numbers in the PR: image bytes and CLS/LCP for one representative docs page at a phone width and at desktop width.
-
docs/AGENTS.md, thewrite-docsskill and the screenshot-capture README describe the new flow; the Turbo input globs and their guards (services/docs/turbo.json,services/web/turbo.json) cover any newly generated files.
Open decisions
- Scope of "different dimensions": delivered widths (part 1), capture viewports (part 2), or both.
- Whether generated variants are committed (as the marketing site does: "no build-step dependency") or built.
Activity
tale-code-bot commentedon Nov 1, 2026
Triage split this issue in three (task TALE-112):
Responsive delivery of the docs images (EN, DE and FR trees). This covers:
srcset,sizesandwidth/heighton every docs image.TALE-112 works it, and its commit will close this issue.
Per-viewport capture (phone, tablet, desktop) with
<picture media>: feat(docs): capture screenshots per viewport where the layout differs #5250.README tiles, social cards, video posters and the in-app image audit: perf: right-size README tiles, social cards and in-app images #5251.
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
test(docs): check every built page serves its screenshots responsively
perf(docs): size docs images by their column, not auto
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
tale-code-bot commentedon Nov 1, 2026
Landed on the feature line
release/0.6with feature train #5265, merged by rebase at 2026-11-01 17:57:59Z, as b2bd5ceperf(docs): serve each docs image in the widths a screen needs(task TALE-112). It ships with Tale 0.6.0.GitHub closes an issue from a
Closes #4686line only for a commit on the default branchmain, so the feature-train role closes it here.perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs
perf(docs): serve each docs image in the widths a screen needs