A stylesheet can change even when its filename stays the same. A browser with a fresh cached response may have no reason to request that URL again. On our static site, the build adds a token derived from the stylesheet bytes to the URL in generated HTML. That gives a page a different URL to request after an edit, while a reference to an unchanged script can stay stable. We checked that behavior in a local build, tried a reference the rewrite leaves alone, and sampled the cache headers on the live site.

Change one asset

We built the same website revision twice. For the second build we appended a synthetic comment to the shared stylesheet. The comment let us change the bytes without needing a visual change. In the generated home page and Engineering index, the ordinary reference to that stylesheet got a different token. The script reference kept its original token. We independently hashed the copied stylesheet in each output directory and checked that the beginning of each digest matched its generated token.

The unchanged script gives that comparison a control. If the build used a timestamp shared by all references, a second build could change both URLs even when we edited only the stylesheet. In this fixture the script URL stayed stable. The build also constructs the Engineering index before it rewrites the asset references, so the comparison covered both a regular HTML page and a generated page. We inspected those two pages directly. The experiment checked what the build emitted inside those files.

Look at the two responses

A reader first needs HTML that carries the new reference. A browser can keep using an earlier stylesheet URL if it is still working from an earlier page response. A shorter freshness lifetime for HTML gives that response an earlier opportunity to be checked again. Once the reader loads HTML with the new URL, the changed query token gives the browser a different URL for its asset request. That sequence describes how the two cache policies can work together. We did not track a returning browser through a release.

In a live HTTP sample, the home page and Journal advertised five minutes of freshness with revalidation once stale. The sampled stylesheet response advertised one year and was marked immutable. Its bytes matched the local baseline stylesheet. We also requested that same asset path with an arbitrary alternate query token and received the same bytes. For that request, changing the token did not retrieve a historical copy. The sample came from one vantage point and cannot establish how other caches behave or how quickly a change reaches readers.

Try a reference that already has a token

For the second build we also added a synthetic stylesheet link that already had a query token. The builder left that reference as written, even though it rewrote the ordinary reference to the same stylesheet on the same page. We reran the focused regression test from the modified source tree. The test rebuilt the site and passed. Its assertion looks for a particular spelling of an unversioned reference. The handwritten query string makes the synthetic link fall outside that pattern.

That counterexample gives the two checks distinct jobs. The regression test looks for a missing token on the reference forms it recognizes. Comparing a generated reference with the bytes behind it checks whether its token agrees with the asset in that build. A link can satisfy the first check while still carrying a value that did not come from those bytes. Our injected link was a test input. The experiment gives us no estimate of how often a reference like that might appear in deployed pages.

The decision to give assets long cache lifetimes works with a build that can change the references readers receive. In this case, the local comparison showed exactly where that happened, and the negative fixture exposed a gap in what the test could assert. The hosted sample answered a separate question about the responses the site served at that moment. Together those observations let us explain which URL changed, which stayed stable, and why the moment a reader gets the new HTML remains outside the experiment.

← All engineering articles