Repository navigation
Improve caching for static assets (cache busting via content hash) - #152
Merged
Merged
Conversation
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changeset improves caching for static assets by serving them from content-hashed URLs like
src/tailwind.f1cdccc.csswith aCache-Control: max-age=31536000, immutableheader. 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.cssandapp.v2.jsnames. It replaces the hand-maintained.v2suffixes 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)