website: move placeholders to src/assets for Vite base64 inlining, add LazyVideo component

Placeholders are now generated into src/assets/placeholders/ instead of
public/ so Vite's asset pipeline processes them. Since all are < 4KB,
Vite auto-inlines them as base64 data URIs via assetsInlineLimit — zero
extra HTTP requests for placeholders.

- Static imports resolve to data:image/png;base64,... at build time
- JSDoc on placeholder props documents why static imports are required
  (synchronous availability, Vite inlining) and warns against dynamic
  imports and public/ paths
- New LazyVideo component: same pixelated poster pattern, uses native
  <video preload="none" loading="lazy"> for zero-JS lazy loading
This commit is contained in:
Tommy D. Rossi
2026-02-21 15:58:21 +01:00
parent 3b3959f5ab
commit ee948930fe
7 changed files with 155 additions and 5 deletions
+2 -1
View File
@@ -20,6 +20,7 @@ import {
Li,
PixelatedImage,
} from "website/src/components/markdown";
import placeholderScreenshot from "../assets/placeholders/placeholder-screenshot@2x.png";
export const meta: MetaFunction = () => {
const title = "Playwriter - Control your Chrome with Playwright API";
@@ -73,7 +74,7 @@ export default function IndexPage() {
<div className="bleed" style={{ display: "flex", justifyContent: "center" }}>
<PixelatedImage
src="/screenshot@2x.png"
placeholder="/placeholder-screenshot@2x.png"
placeholder={placeholderScreenshot}
alt="Playwriter controlling Chrome with accessibility labels overlay"
width={1280}
height={800}