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
In earlier PRs I worked on PageSpeed where it complained about caching that isn't aggressive enough. We couldn't fully fix it then because our assets (JS, CSS etc.) all had static names (foo.css). So when we'd say "cache this for a day" we wouldn't see updates for a longish time.
This PR changes three things:
icons.svgfile with just the icons from FontAwesome we actually use. This PR changes it again to generate that file dynamically as well*Preloads
noto-sans-700(Lighthouse showed it arriving late through the css chain on pages with bold text above the fold).