build(examples/gastro): gitignore tailwind output, generate on demand
Removes examples/gastro/static/styles.css from version control and
treats it like every other generated artifact in the project (the
.gastro/ tree, example binaries, etc.).
Why
---
Committing the Tailwind output forced a minify-on-commit /
unminify-during-dev workflow with a CI drift gate (`go generate
./... && git diff --exit-code`). Every contributor and agent
edit cycle had to remember to regenerate the minified form before
staging, or CI would fail. The committed 50KB blob also obscured
source review every time a new utility class landed.
Tailwind output is generator-produced and noise-prone to commit.
It's consistent with how the project treats .gastro/ (gitignored,
regenerated by `gastro generate`).
What changed
------------
.gitignore
- New entry: examples/gastro/static/styles.css. Adjacent comment
explains the bootstrap requirement.
- Removed the stale "committed examples/gastro/static/styles.css
is what ships" sentence from the node_modules comment.
git rm --cached examples/gastro/static/styles.css
- Untracks the file; subsequent generators write to a gitignored
path.
scripts/dev/example-website
- New `if [ ! -f static/styles.css ]; then tailwindcss ...; fi`
bootstrap line before `exec gastro watch`. Without it the dev
watcher's first Generate would copy an empty static/ into
.gastro/static/ before --asset has a chance to fire, and the
first page load would 404 on /static/styles.css. The check is
a no-op on subsequent runs.
examples/gastro/Dockerfile
- Install the standalone tailwindcss binary (v4.3.0-linux-x64-musl
to match mise.toml and alpine's libc). wget added to apk install
list.
- Replace `RUN gastro generate` with `RUN go generate ./...` so
both //go:generate directives run in order (tailwindcss first,
then `gastro generate`). Keeps host and Docker bootstrap
commands identical.
.github/workflows/ci.yml
- Drop the `git diff --exit-code` drift check. The file is now
gitignored so no tracked file can drift. Keep the
`go generate ./...` step as a smoke test that the generators
still run cleanly against the gitignored fresh state.
cmd/gastro/watch.go
- New `suspectedAssetOutputCollision` companion to the existing
`suspectedBuildOutputCollision`. The asset variant permits
writes into static/ (the canonical Tailwind / esbuild / image-opt
destination) and only flags writes into pages/ or components/
where they'd feed back into Generate and loop. Without this
every legitimate --asset Tailwind setup printed a noisy false-
positive warning at startup.
- Extract shared `-o <path>` parsing into a `parseOutputPath`
helper consumed by both collision checkers.
- Updated startup call site for --asset to use the new function
and a more accurate warning message ("under a watched source
path", since static/ is no longer in the flagged set).
examples/gastro/AGENTS.md
- Replace the "must be minified, CI drift gate" warning with
bootstrap docs: gitignored, regenerated by `go generate ./...`
or the mise dev task, with notes on the dev / production
minification asymmetry and the Tailwind version pin alignment
requirement.
cmd/gastro/watch_test.go
- New `TestSuspectedAssetOutputCollision` covering the canonical
cases: Tailwind into static/ (allowed), esbuild into static/
(allowed), tmp/ (allowed), pages/ and components/ (flagged),
no -o (allowed).
Trade-offs
----------
- Fresh clone needs `go generate ./...` before `go build` produces
a website with CSS. Documented in AGENTS.md; the mise dev task
handles it automatically.
- Production builds need tailwindcss available. Dockerfile installs
it explicitly with a pinned version; the mise.toml-managed local
binary handles dev and CI.
- One more "tool must be on PATH" requirement to keep in sync with
mise.toml. AGENTS.md calls this out.