Skip to content

implement cache busting #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

implement cache busting #84

wants to merge 1 commit into from

Conversation

Aloso
Copy link

@Aloso Aloso commented Jun 20, 2025

Implements cache busting for

  • caniuse_rs.wasm 🡒 caniuse_rs.{build_id}.wasm
  • caniuse_rs.js 🡒 caniuse_rs.{build_id}.js
  • style.css 🡒 style.{build_id}.css

This is done with a Tera variable and a Rollup banner containing the build id, which is the timestamp of the build.

Unfortunately, this pollutes the public folder over time since old assets aren't removed. If you know a solution, LMK.

Perhaps it would be better to use Vite, which has cache busting built in.

@Aloso Aloso mentioned this pull request Jun 20, 2025
@jplatte
Copy link
Owner

jplatte commented Jun 20, 2025

Thanks, but I don't really think changing the file names should be required. It's probably a matter of setting the right cache-control header, setting up ETag, or something like that.

@Aloso
Copy link
Author

Aloso commented Jun 20, 2025

You can disable the browser cache with Cache-Control: no-cache. The downside is that consecutive page loads will be slightly slower because of this.

By embedding an id or checksum in the file name, caching still works, but you never get an outdated version of the file.

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