Repository navigation
Draw the sidebar group caret with CSS instead of an inline SVG per group #4422
IEvangelist
started this conversation in
Feature Requests
Replies: 1 comment
|
We could do this potentially I think. I’d note though that given the HTML should be compressed over the wire (with gzip or brotli), the impact of the repeated markup should be pretty minimal, and I would be surprised to see measurable impact on end users. That said, especially for large sites like yours it may be worth it for other reasons — skipping a small amount of repeated rendering work at build time and saving a little disk space for the build output. (Both would be marginal improvements, but marginal can still be valuable at scale.) |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
What version of
starlightare you using?0.41.3
What is your idea?
Draw the
SidebarSublistgroup caret with CSS (amaskon a<span class="caret">) instead of rendering<Icon name="right-caret">, which inlines an identical SVG for every group:The
[open] > summary .caretrotation and the RTL flip keep working unchanged.Why is this feature necessary?
The caret SVG is about 330 bytes and appears once per sidebar group on every page. Large generated sidebars (API references) have hundreds of groups: on aspire.dev's API pages it was 214–390 carets, roughly 70–130 KB of identical markup per page across about 29k pages. A CSS mask moves that to one stylesheet rule. aspire.dev ships this as a local patch of
components/SidebarSublist.astro.Do you have examples of this feature in other projects?
Icons drawn with CSS masks are a common way to avoid repeated inline SVG in navigation trees.
Participation
All reactions