Skip to content
slidepig.

Documentation

Artwork workflow

Plan backgrounds, keep prompts and credits, and add finished artwork when it’s ready.

On this page

Keep image prompts and provenance in an art manifest while the slides remain usable as drafts. slidepig art resolves planned originals into a typed background module: a missing original becomes a color or fallback image, and an existing original supplies src. It does not generate or edit images.

The optional workflow uses Node's filesystem APIs during authoring and builds. Decks import plain data, with no filesystem calls, Vite globals, or additional browser dependencies.

A scene manifest

Put art.config.json in the directory that owns the content:

{
  "root": "public",
  "outFile": "src/generated/backgrounds.ts",
  "scenes": {
    "room": {
      "src": "/art/room-final.webp",
      "prompt": "A quiet reading room, illustrated on warm paper. Leave the left side clear for copy.",
      "placeholder": "/art/room-draft.webp",
      "color": "#faf7ef",
      "tone": "light",
      "overlay": { "color": "#faf7ef", "opacity": 0.9, "fade": "left" },
      "slides": ["partner-pitch#opening", "team-update#opening"],
      "provenance": { "credit": "Your image author" }
    }
  }
}

root and outFile have the defaults shown above. Paths are relative to the manifest's directory, including when the CLI uses --cwd or --config. Scene names use letters, digits, dashes, and underscores, beginning with a letter or digit. Each scene requires a planned local src URL and a prompt.

The final original may be missing. A declared placeholder must be an existing local image; omit it for a color-only draft. color, tone, position, and overlay become background defaults, with slide settings taking precedence. fade: "left" keeps the overlay strongest on the left; "right" reverses it and "none" uses a flat tint.

slides is optional usage information for the people preparing the images. Optional provenance fields are sourceUrl, credit, generator, model, and createdAt. Record actual provenance when available; these fields and the prompt stay in the manifest, not the generated page data.

Generate and import

From the content directory:

npx slidepig art
npx slidepig art --status
npx slidepig art --prompts > art-prompts.md
npx slidepig art --check

The default command creates src/generated/backgrounds.ts. Import it and pass its registries to your decks or shared slide helpers:

import { defineDeck } from "slidepig";
import backgrounds from "./generated/backgrounds";

export default defineDeck({
  title: "A reading room",
  description: "Our plan for a welcoming neighborhood reading room.",
  backgrounds,
  slides: [{ id: "opening", title: "A place to gather.", background: "room" }],
});

The generated module contains satisfies Record<string, DeckBackground> so registry names and values such as tone and fade keep their TypeScript types. Commit it alongside the manifest and original images. Regenerate it instead of editing it, and exclude **/generated/*.ts from formatters that would rewrite its machine-generated data.

--status and --prompts are read-only. Prompt output includes each scene's exact absolute save path. --check also writes nothing and fails when the generated module is stale; pending originals are allowed. Add --require-complete when missing final artwork should fail the command:

npx slidepig art --check --require-complete

For a content package, run from the site app with slidepig art --cwd ../../packages/example-decks. To select another manifest, use --config path/to/art.config.json.

Watch for finished art

Sites can generate the module before Vite resolves their deck imports and watch the manifest, planned originals, and placeholders:

// apps/workspace-site/vite.config.ts
slidepigSite({ art: "../../packages/example-decks/art.config.json" });

The option's path is relative to the Vite root. When an original is saved at its planned path, the next generation includes src. When it is removed, the scene returns to its draft fallback. The site plugin regenerates and reloads during development; a production build resolves the current files. An app that does not use this plugin can run the CLI before its own build.

Image optimization remains a separate step: run slidepig assets in the content directory before the site's build, and serve that package's public/ through the app's publicDir. See the asset guide and monorepo example.

Node API

Import authoring utilities from slidepig/art in Node tooling:

  • resolveArt(config, cwd) resolves scene states and background data.
  • readArt(configFile) reads JSON and returns absolute file paths to watch.
  • generateArt(configFile, { check }) generates only when its contents change.
  • formatArtStatus(result) and formatArtPrompts(result) produce text output.

Results include backgrounds, scenes, root, outputFile, and watchFiles. Scene states are ready or pending; save paths are absolute. generateArt also returns changed and outdated, indicating whether it wrote output and whether the output was stale before the call.

Local source URLs must stay inside the configured public root, and generated output stays inside the manifest's directory. URL traversal and symlink escapes are rejected. This draft-art convention does not relax normal site validation: missing URLs declared directly in a deck still fail the build.

Explore all guides · Getting started