diff --git a/.github/workflows/jekyll.yml b/.github/workflows/jekyll.yml index 7902876..0104ba7 100644 --- a/.github/workflows/jekyll.yml +++ b/.github/workflows/jekyll.yml @@ -30,6 +30,9 @@ jobs: - name: Check WebP derivatives run: python script/generate_webp.py --check + - name: Generate asset version + run: python script/asset_version.py + - name: Setup Pages uses: actions/configure-pages@v5 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d7f5ac8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +_data/assets.yml diff --git a/README.md b/README.md index fcb767f..017a867 100644 --- a/README.md +++ b/README.md @@ -94,3 +94,13 @@ python script/generate_webp.py ``` CI runs `python script/generate_webp.py --check` to ensure WebP copies are present and up to date. Commit the generated `.webp` files with your image changes. + +### CSS/JS cache busting + +CI runs `python script/asset_version.py` before each Jekyll build. It hashes `css/style.css`, `css/github_markdown.css`, and `js/gallery.js`, then writes `_data/assets.yml`. Layout templates append `?v=` that hash to stylesheet and script URLs so browsers fetch new copies when those files change. + +For a local Jekyll preview, run the same script first: + +```bash +python script/asset_version.py +``` diff --git a/_layouts/default.html b/_layouts/default.html index a41d1b7..711f509 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -44,8 +44,9 @@ - - + {% assign assets_version = site.data.assets.assets_version | default: 'dev' %} + +
@@ -140,7 +141,7 @@