perf: Content-hash the bundle assets and take the icons from their package - #903
Open
lfrancke wants to merge 3 commits into
Open
perf: Content-hash the bundle assets and take the icons from their package#903lfrancke wants to merge 3 commits into
lfrancke wants to merge 3 commits into
Conversation
…ckage The css and js entry file names now carry a content hash: vite emits hashed names, the mermaid dist entry gets a sha-based one (its chunks are hashed upstream), and the partials referencing them are rewritten from the manifest while being staged. That makes the files safely cacheable forever, so the netlify rules serve css/js as immutable; fonts and images keep stable names with moderate lifetimes. The rules are non-overlapping on purpose: netlify applies every matching header rule, and overlaps would emit duplicate Cache-Control. The icon sprite is now generated at build time from the @fortawesome/fontawesome-free package instead of vendored path data, so the icons are version-managed like every other dependency. The attribution comments carry the actual package version.
mermaid, pagefind, @asciidoctor/tabs, highlight.js, fontawesome and fontsource each get consumed in a non-obvious way; the README now says how and why, plus how the asset hashing works.
Lighthouse showed noto-sans-700 arriving late through the css chain on pages that use bold text above the fold.
✅ Deploy Preview for stackable-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Description
Closes out the caching story from the perf batch, and removes the last dependency that did not live in package.json:
Content-hashed assets + immutable caching
css/site-DYksAs3N.css,js/site-CeflqSYq.js, ...). Vite emits the hashed names; the mermaid dist entry gets a sha-based name (its chunks already carry upstream hashes); the hbs partials keep referencing unhashed names in the source and are rewritten from the build manifest while being staged./_/css/*and/_/js/*asimmutable, max-age=1y; fonts (stable names, effectively never change) get a week, images a day. The rules are deliberately non-overlapping - netlify applies every matching header rule, so overlapping rules would emit duplicate Cache-Control headers.Icons from their package
img/icons.svgis generated at build time from@fortawesome/fontawesome-free(new devDependency, 6.7.2) instead of vendored path data - the last piece of third-party code that was not version-managed via package.json. Attribution comments in the sprite and NOTICE now carry the actual package version. Note: 6.2.1 -> 6.7.2 may redraw individual glyphs subtly.Docs
ui/README.adocgains a "dependency special cases" section (mermaid verbatim-dist copy, pagefind living outside the bundle, tabs' explicit browser/style paths, highlight.js language curation, fontsource url alias) and an asset-caching section.Also preloads
noto-sans-700(Lighthouse showed it arriving late through the css chain on pages with bold text above the fold).Verification
Full local site build with the new bundle: 3,821 asset references across all pages checked, zero unresolved - every hashed reference in every rendered page points at an existing file, including the rewritten mermaid import and the generated sprite. Lint clean. Note for the deploy preview: sanity-check an icon (external-link arrow) and the search UI, since the sprite is now built from FA 6.7.2 artwork.