Skip to content

Version assets by modification time - #50

Merged
gb-mobile merged 1 commit into
REONTeam:mainfrom
fsegouin:feat/asset-mtime-versioning
Jul 20, 2026
Merged

gb-mobile merged 1 commit into
REONTeam:mainfrom
fsegouin:feat/asset-mtime-versioning

Conversation

@fsegouin

Copy link
Copy Markdown
Contributor

Summary

Replaces hand-maintained ?v= cache-busting strings on CSS and JS assets with an asset() Twig helper that versions each file by its modification time.

  • Adds asset() to TemplateUtil.php: it appends ?v=<mtime> for a given asset path, and falls back to the unversioned path if the file is missing (so a bad path still loads).
  • Converts every local <link> / <script> ?v=... reference across the templates to {{ asset('...') }}.
  • Drops the now-unnecessary inline @font-face blocks from the four pixel-font page templates (the font is defined once in pokecrystal-pages.css).

Assets now re-fetch automatically whenever their contents change, instead of relying on someone remembering to bump a version string.

Testing

php -l passes on TemplateUtil.php. Loaded every page and confirmed the CSS/JS still resolve. Rendering is unchanged.

Add an asset() Twig helper that appends a file's mtime as a cache-busting query
and use it for the CSS and JS links across the templates, in place of the
hand-maintained version strings. Also drop the redundant inline @font-face
blocks from the pixel-font page templates, which the shared stylesheet already
defines.
@gb-mobile
gb-mobile merged commit 2a966a2 into REONTeam:main Jul 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants