Skip to content
Edit this page

This documentation

It lives in its own repository, neoneye/sew-fantasy-docs, and is published below the page, at https://neoneye.github.io/sew-fantasy/documentation/.

Changing it

python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
.venv/bin/zensical serve

Open http://localhost:8000/sew-fantasy/documentation/. The pages are Markdown files under docs/, and the menu is the nav in mkdocs.yml.

The pages Every garment and Cloths and prints are taken from the code. With both repositories side by side, this writes them anew:

node tools/tables.mjs

The garment pages

Every garment has a page of its own, docs/garment/<id>.md (for example Mid-blue straight-leg jeans): its picture worn on the mannequin, a short loop of each of its fabrics turning in the light, what the cloth costs, Wikipedia links, searches in shops, and how it is made. They are not in the menu; the garment list and the group pages link to them. Two scripts write them, after tools/tables.mjs:

node tools/render.mjs
node tools/pages.mjs

tools/render.mjs runs on a Mac with Chrome and ffmpeg (Homebrew), and draws with the real graphics card, since software WebGL draws false shadows. It serves the page joined from its parts, opens each garment as a still on the slate backdrop, saves the app's clean export (docs/media/garments/<id>.jpg, 900 × 1200) and the app's own report of it (tools/data/garments/<id>.json: pieces, steps, machines, how much of each cloth to buy). For every fabric in use (a cloth with its print and colour) it draws 72 frames of a square of it hanging in folds (__sf.swatchURL, in parts/ui-09e-swatch.js) and encodes them as a 3-second MP4 and a poster, docs/media/fabrics/. A fingerprint of each in tools/data/render.json means only what is new or has changed is drawn again; --all draws everything, --only=id,id only those garments, --no-loops skips the loops. All of it takes about an hour; commit what it writes.

tools/pages.mjs needs no Chrome and no network. Beside the saved reports it reads three files written by hand in tools/data:

  • prices.json: a typical shop price per cloth, in USD per metre at 150 cm wide (leather and other skins per square metre), with the date and the rate for EUR. A length costs its metres times the price, scaled by its width; a remnant its area; a skin its area.
  • wikipedia.json: the articles for each cloth, print and group of garments. After changing it, check the titles with node tools/wikipedia-check.mjs: each must exist and not be a disambiguation page.
  • search.json: a better shop search for garments whose names search badly.

To rename a garment, change its key in SF.GARMENTS and everywhere it is named, and add old: 'new' to MERGED in parts/ui-02-scene.js: old links and saved settings then open the new one, and tools/pages.mjs leaves a page at the old address that sends the reader on. Rename its picture and report here too, and its key in tools/data/render.json, or it is drawn again.

The shop searches carry no affiliate or tracking parameters, and must not.

How it is published

GitHub gives each repository one site, and the address /sew-fantasy/ belongs to the repository sew-fantasy. So that repository's workflow (.github/workflows/pages.yml) builds both: the page with Jekyll, and this documentation into the folder documentation. It runs when the code changes, and once a day to pick up changes here.

A change to the documentation can be published at once by starting that workflow by hand, under Actions → Pages → Run workflow, or with:

gh workflow run pages.yml --repo neoneye/sew-fantasy