caniuse.rs icon indicating copy to clipboard operation
caniuse.rs copied to clipboard

implement cache busting

Open Aloso opened this issue 6 months ago • 2 comments

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 avatar Jun 20 '25 10:06 Aloso

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.

jplatte avatar Jun 20 '25 10:06 jplatte

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.

Aloso avatar Jun 20 '25 11:06 Aloso