fix(hooks): build css before pre-commit checks #272

Merged
vas2000-work merged 2 commits from fix/pre-commit-clean-clone into main 2026-06-18 04:44:34 +02:00
Owner

Root cause

On a clean clone just pre-commit fails at the clippy stage with Asset at /assets/styles.css doesn't exist. src/main.rs uses asset!("/assets/styles.css"), which the Dioxus asset macro resolves at compile time. assets/styles.css is the Tailwind build output and is gitignored, so it is absent on a fresh checkout and clippy (and the subsequent cargo check) cannot expand the macro.

Fix

Add the existing css-build recipe as a prerequisite of pre-commit (pre-commit: css-build). css-build (which itself depends on ensure-npm) runs bun x @tailwindcss/cli --input input.css --output assets/styles.css, regenerating the asset before the Docker-based fmt/clippy/check/test steps run.

Verification

Removed the local assets/styles.css to simulate a clean clone, then ran just pre-commit: css-build regenerated the file, and all stages passed - cargo fmt --all --check, cargo clippy --all-targets -- -D warnings, cargo check --target wasm32-unknown-unknown, and cargo test --lib (146 passed; 0 failed). Final line: [pre-commit] all checks passed (exit 0).

Part of DEV-370.

## Root cause On a clean clone `just pre-commit` fails at the clippy stage with `Asset at /assets/styles.css doesn't exist`. `src/main.rs` uses `asset!("/assets/styles.css")`, which the Dioxus asset macro resolves at compile time. `assets/styles.css` is the Tailwind build output and is gitignored, so it is absent on a fresh checkout and clippy (and the subsequent `cargo check`) cannot expand the macro. ## Fix Add the existing `css-build` recipe as a prerequisite of `pre-commit` (`pre-commit: css-build`). `css-build` (which itself depends on `ensure-npm`) runs `bun x @tailwindcss/cli --input input.css --output assets/styles.css`, regenerating the asset before the Docker-based fmt/clippy/check/test steps run. ## Verification Removed the local `assets/styles.css` to simulate a clean clone, then ran `just pre-commit`: css-build regenerated the file, and all stages passed - `cargo fmt --all --check`, `cargo clippy --all-targets -- -D warnings`, `cargo check --target wasm32-unknown-unknown`, and `cargo test --lib` (146 passed; 0 failed). Final line: `[pre-commit] all checks passed` (exit 0). Part of DEV-370.
fix(hooks): build css before pre-commit checks
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 3m34s
b02dd2e0aa
Add css-build as a prerequisite of the pre-commit recipe so the Tailwind output exists before clippy and cargo check run. src/main.rs uses asset!("/assets/styles.css"), which requires the built CSS file at compile time, but assets/styles.css is gitignored (a build output), so on a clean clone it is absent and clippy fails with `Asset at /assets/styles.css doesn't exist`. css-build (already present, depends on ensure-npm) regenerates it via bun + the Tailwind CLI before the Docker-based checks.

#DEV-370
Merge branch 'main' into fix/pre-commit-clean-clone
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 1m21s
Create release / Create release from merged PR (pull_request) Has been skipped
afb6ac6311
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-apps!272
No description provided.