Skip to content

Improve caching for static assets (cache busting via content hash) - #152

Merged
clue merged 1 commit into
clue:mainfrom
clue-labs:cache-busting
Sep 26, 2026
Merged

clue merged 1 commit into
clue:mainfrom
clue-labs:cache-busting

Conversation

@clue

@clue clue commented Sep 26, 2026

Copy link
Copy Markdown
Owner

This changeset improves caching for static assets by serving them from content-hashed URLs like src/tailwind.f1cdccc.css with a Cache-Control: max-age=31536000, immutable header. Previously all files were capped at the 1 day from #151, so a changed stylesheet or script could keep serving stale for a day, and an unchanged one was revalidated daily.

This mirrors https://github.com/clue-engineering/miley/pull/94 (private), which shipped the same change for miley's stylesheet. The hash is computed when the site is generated and only appears in the public URL, so the sources keep their tailwind.min.css and app.v2.js names. It replaces the hand-maintained .v2 suffixes from #93. Pages cached from before this lands still point at the old URLs, so the CDN wants a purge afterwards. The integration tests cover all three assets, their headers and that the old URLs are gone.

Builds on top of #151, #93 and #136
Refs #145, https://github.com/clue-engineering/miley/pull/94 (private) and https://github.com/clue-engineering/justkanban/pull/25 (private)

@clue clue added the new feature New feature or request label Sep 26, 2026
@clue
clue requested a lite review from Copilot September 26, 2026 20:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Regenerate composer.lock and ensure existing builds rerun asset generation when these inputs change.

Review effort: Lite
Findings: None

What changed in this PR

Adds content-hashed CSS/JS URLs with immutable caching, replacing manual version suffixes.

Changes:

  • Generates hashed asset URLs and updates templates.
  • Adds long-lived Apache caching headers.
  • Expands integration tests for hashed assets and legacy URL removal.
File Summary
www/​.htaccess Adds immutable caching; build prerequisites should include generation inputs.
www/​_layouts/​default.html References assets through the cache-busting helper.
tests/​integration.bash Verifies hashed URLs, headers, and removed legacy URLs.
composer.json Registers development autoloading; composer.lock should be regenerated and committed.
app/​config/​sculpin_services.yml Registers the cache-busting service.
app/​CacheBusting.php Generates content-hashed asset paths.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@clue
clue merged commit 0da18c9 into clue:main Sep 26, 2026
2 checks passed
@clue
clue deleted the cache-busting branch September 26, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants