diff --git a/.gitea/workflows/check.yml b/.gitea/workflows/check.yml index ebbfd5d..d7b72bf 100644 --- a/.gitea/workflows/check.yml +++ b/.gitea/workflows/check.yml @@ -28,10 +28,10 @@ jobs: - name: Fingerprint the build context # Writes the hash of the commit being checked into the context, which - # invalidates the `COPY . .` layer of both check stages: a commit - # that was never linted, format-checked, tested and built cannot - # report success from cache. + # invalidates the `COPY . .` layer of every check stage: a commit + # that was never linted, format-checked, stylesheet-checked, tested + # and built cannot report success from cache. run: git rev-parse HEAD > .ci-fingerprint - - name: Build Docker image (runs make fmt-check, golangci-lint, make test, make build) + - name: Build Docker image (runs make fmt-check, golangci-lint, the stylesheet check, make test, make build) run: script/cibuild diff --git a/Dockerfile b/Dockerfile index de462a2..0899ae6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,8 +55,12 @@ RUN tailwindcss -i static/css/input.css -o /out/tailwind.css --minify FROM scratch AS css-output COPY --from=css /out/tailwind.css / +# Both files are split after each "}", one rule per line, so that when they +# differ the diff shows the rules that differ. FROM css AS css-check -RUN cmp /out/tailwind.css static/css/tailwind.css || { \ +RUN sed 's/}/}\n/g' static/css/tailwind.css > /tmp/committed.css \ + && sed 's/}/}\n/g' /out/tailwind.css > /tmp/generated.css \ + && diff -U0 /tmp/committed.css /tmp/generated.css || { \ echo "static/css/tailwind.css is not what make css generates; run make css" >&2; \ exit 1; \ } diff --git a/README.md b/README.md index 4c43d3d..2ce6739 100644 --- a/README.md +++ b/README.md @@ -1398,13 +1398,13 @@ the `dist.integrity` hash listed at ## Stylesheet `static/css/tailwind.css` is generated by Tailwind and committed. To change the -styles, edit the templates, `static/js/app.js` or `static/css/input.css`, run -`make css`, and commit the regenerated file with the change. Tailwind takes -classes only from the files that `input.css` names in its `@source` lines; a -class written in any other file is not generated until that file is named there -too. `make check` and the image build fail when the committed file differs from -what `make css` generates. `static/css/style.css` is hand-written and is not -generated. +styles, edit the templates, `static/js/app.js`, +`internal/handlers/recent_events.go` or `static/css/input.css`, run `make css`, +and commit the regenerated file with the change. Tailwind takes classes only +from the files that `input.css` names in its `@source` lines; a class written in +any other file is not generated until that file is named there too. `make check` +and the image build fail when the committed file differs from what `make css` +generates. `static/css/style.css` is hand-written and is not generated. `make css` runs the Tailwind standalone CLI in Docker, at the version and sha256 pinned in the Dockerfile's stylesheet stages; it is never installed on the host.