Conversation
Extracts ~30KB of DocSearch CSS from the main stylesheet into a separate file (docsearch.<hash>.css) that is only loaded when the user first interacts with the search button (mouseover/focus/click). Reduces inlined CSS from ~132KB to ~102KB. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The button is always visible on initial load, so its styles must be inlined rather than lazy-loaded. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
--docsearch-* custom properties (e.g. --docsearch-searchbox-height) are referenced by .DocSearch-Button styles. Deferring them caused the button to snap to the correct size when the lazy CSS loaded, triggering a layout shift. Now all :root variable definitions stay in the inlined CSS. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
Author
|
Unfortunately, these hacks dont work. Right now, the question is if it makes sense to even keep the search bar since I heard it doesnt work well, if it just adds bloat to the website and makes it slow. Or we fix the search and it becomes really good, which is also an option ;) But the work here isn't mathing, it just creates some ugly visual flakes. |
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.
Summary
docsearch.<hash>.cssfileHow it works
The
preload-css.jspost-build plugin now:@mediarules.DocSearchselectors /--docsearch-variables), keeping mixed:rootblocks in main CSSmouseover/focus/clicklisteners to the search button and loads the stylesheet on first interactionTest Plan
npm run buildand verify no errors<style>in HTML contains no.DocSearchclassesdocsearch.<hash>.cssis present inbuild/assets/css/