Repository navigation
Stamp the stylesheet and scripts with their content, so a deploy never pairs new HTML with old files - #31
Merged
Conversation
…r pairs new HTML with old files index.html linked styles.css and theme.js with hand-bumped versions and stack.js and tools.js with none, so after a deploy a browser could keep an old copy and show a broken page until a hard refresh. npm run stamp now writes a content hash into each link, and CI fails when one is out of date.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
After a deploy, the page could look broken until a hard refresh. index.html is fetched fresh, but
stack.jsandtools.jshad no version andstyles.css/theme.jsrelied on hand-bumped?v=numbers, so browsers kept old copies (Cloudflare tells them to for 4 hours).Changes
npm run stampwrites a content hash into each stylesheet and script link in index.html, e.g.stack.js?v=8b37b17e.node scripts/stamp-assets.mjs --checkand fails when a stamp is out of date.Verification
--checkfailed before stamping and passes after.npm test: 9 passed.