The manifest contract
data/media.manifest.mjs default-exports an array of entries:
{ slot, src }fetches a remote image and uploads it to the target site’s media library. Rights note: this fetches third-party URLs verbatim; run it only for assets you own or license.{ slot, file }uploads a local file. Supported image formats: jpg, jpeg, png, webp, svg, gif.{ slot, type: 'font', file, family, role, weight }embeds a local font file (woff2 or woff) as a base64 data-URI in the map. WordPress blocks woff2 uploads by default; a data-URI@font-faceneeds no server configuration. The compiler emits the@font-facecarrier for you; this path is for custom licensed font files only. Google fonts load natively via style props (see Components).alton image entries is set as the attachment’s alt text.
Idempotency by slot
Every entry is keyed by itsslot; attachments are slugged exjsx-<slot>.
Re-running the command is safe:
- A local file whose bytes match the map’s hash is skipped with zero network
calls (
SAME). - A
srcentry whose slug already exists in the library is kept (KEEP). - A local file with changed bytes replaces the stale attachment (
REUP), so a recolored logo actually reaches the site instead of silently serving the old one.
The map: data/media-map.json
The command writesdata/media-map.json (the optional second CLI argument
overrides the path): { slot: { id, url, alt } } for images and
{ slot: { type: 'font', family, role, weight, url } } for fonts. Read ids
and URLs from the map; never hardcode them.
- URL-src
<img>takes inlinealt; never leave it empty (lint:img-alt). - Attachment-id images take alt from the attachment only; the compiler throws
if you pass
altthere, and the error carries the recipe.
Next
Deploy
Build, lint, and ship the bundle.
Styling
bgImage, bgOpts, and image fitting.