Version the CSS and JS links with a content hash #34

Merged
rob merged 1 commit from cache-busting into main 2026-10-08 13:10:08 +00:00
Collaborator

The build appends a short content hash to the stylesheet and script links, e.g. /styles.css?v=65f4446c, so a browser never serves a stale copy after a deploy. The server caches any non-HTML request carrying a v query for a year as immutable. Unversioned CSS and JS keep the one-day cache, and HTML stays no-cache.

Tests cover both links carrying a hash and the immutable header only appearing on versioned URLs. Build, node --test and html-validate pass.

The build appends a short content hash to the stylesheet and script links, e.g. `/styles.css?v=65f4446c`, so a browser never serves a stale copy after a deploy. The server caches any non-HTML request carrying a `v` query for a year as immutable. Unversioned CSS and JS keep the one-day cache, and HTML stays no-cache. Tests cover both links carrying a hash and the immutable header only appearing on versioned URLs. Build, `node --test` and html-validate pass.
Version the CSS and JS links with a content hash
All checks were successful
CI / check (pull_request) Successful in 15s
CI / deploy (pull_request) Has been skipped
0b9c4bf385
The build appends a short hash of each file as a query string, and the server caches any versioned asset for a year as immutable. HTML stays no-cache so a deploy picks up new links straight away.
rob merged commit 2780a9910e into main 2026-10-08 13:10:08 +00:00
rob deleted branch cache-busting 2026-10-08 13:10:08 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
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
rob/CamperCan!34
No description provided.