Skip to content

Add preview:cards — render the per-card loop + poster GUIDE asks for - #13

Open
Mimmo2026 wants to merge 1 commit into
nateherkai:mainfrom
Mimmo2026:pr/preview-cards
Open

Mimmo2026 wants to merge 1 commit into
nateherkai:mainfrom
Mimmo2026:pr/preview-cards

Conversation

@Mimmo2026

Copy link
Copy Markdown

What

Adds npm run preview:cards, which renders the per-card preview loop and poster that style-library/GUIDE.md already requires.

GUIDE defines a card as done when it "lints clean, previews correctly in the Studio, and has a rendered preview MP4 + poster", and its Previews section says:

The preview script is added once the first real card exists (so it's tested against something real).

Both shipped styles have real cards — 406 of them — and the script was never added, so no style currently has the previews GUIDE treats as part of "done".

Usage

npm run preview:cards -- 02-kallaway
npm run preview:cards -- 02-kallaway --card kallaway.t1.section.ascend
npm run preview:cards -- 01-vox-explainer --seconds 3

--card renders one card, which makes a 300-card style testable without rendering all of it.

Three things it works around

The CLI renders a project directory, not a loose file. Each card is copied into a scratch project under tmp/ with its tokens.css beside it, and the ../../tokens.css href is rewritten to match.

tier2 cards are transparent overlays and would preview as a black frame. They render over a neutral backdrop that exists only inside the scratch copy — the card itself is never modified.

MP4 loops go to renders/previews/<style>/, not next to the posters. Writing them beside the posters takes npm run check from 0 errors to 3, because check-kit.mjs flags loose media in the distribution. renders/ and tmp/ are both already in .gitignore, so this needs no ignore changes. Posters stay with the style, matching GUIDE's note that "any original preview posters" are committed while the loops are regenerable.

One small deviation from GUIDE worth flagging: it says to grab frame 1 as the poster. Frame 1 is the first frame of the entrance animation, which on most cards is empty or mid-transition. This takes the poster after the entrance settles instead, so the poster shows the card.

Tested

Both shipped styles, tier1 and tier2:

  • kallaway.t1.section.ascend — 7.4s source, loop + poster
  • kallaway.t2.lower-third.avatar — 7.0s source, loop + poster, correct over the backdrop

Requires FFmpeg 7+ — the same floor cut-silences and cut-mistakes already need. No new dependencies.

GUIDE.md says a card is done when it 'lints clean, previews correctly in the
Studio, and has a rendered preview MP4 + poster', and that 'the preview script
is added once the first real card exists (so it's tested against something
real)'. Both styles have real cards; the script was never added.

  npm run preview:cards -- 02-kallaway
  npm run preview:cards -- 02-kallaway --card kallaway.t1.section.ascend
  npm run preview:cards -- 01-vox-explainer --seconds 3

Three things it has to work around, all noted in the file:

  - The CLI renders a project directory, not a loose file, so each card is
    copied into a scratch project under tmp/ with its tokens.css beside it.
  - tier2 cards are transparent overlays and would preview as black, so they
    render over a neutral backdrop that exists only in the preview.
  - MP4 loops go to renders/previews/<style>/, not next to the posters:
    check-kit.mjs rejects loose media in the distribution, and both renders/
    and tmp/ are already gitignored. Posters stay with the style, which
    matches GUIDE ('any original preview posters' are committed).

Poster is grabbed after the entrance settles rather than at frame 1, so it
shows the card instead of its first frame of animation.

Tested on both shipped styles, tier1 and tier2. Requires FFmpeg 7+, the same
floor the cut scripts already need.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant