Show the rules a stale stylesheet differs in (closes #231)
check / check (push) Waiting to run
check / check (push) Waiting to run
The css-check stage splits both stylesheets after each "}" and prints their diff, so a failure names the rules that differ instead of a character position. The check workflow's fingerprint comment and build step name now include the stylesheet check, as the README does. The README's Stylesheet section names internal/handlers/recent_events.go among the files to edit. Model: opus-5-5
This commit is contained in:
@@ -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
|
||||
|
||||
+5
-1
@@ -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; \
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user