Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-introduce CSS code splitting #6228

Open
1 of 2 tasks
slorber opened this issue Dec 30, 2021 · 0 comments
Open
1 of 2 tasks

Re-introduce CSS code splitting #6228

slorber opened this issue Dec 30, 2021 · 0 comments
Labels
domain: performance Related to bundle size or perf optimization proposal This issue is a proposal, usually non-trivial change

Comments

@slorber
Copy link
Collaborator

slorber commented Dec 30, 2021

Have you read the Contributing Guidelines on issues?

Motivation

Currently, Docusaurus outputs a single big CSS file.

We do this because it's hard to code split CSS and do lazy loading properly without having nasty side-effects.

User navigation might change CSS insertion order leading to different rules being applied according to the current navigation history.

See reasons why we emit a single CSS file: #2006

It is a hard problem but we should figure out a way to solve it someday.

That seems reasonable that Infima and classic theme CSS is emitted as a single CSS file (it's hard to code split properly considering Infima is already quite monolithical)

But for custom site pages, we might be able to do something and emit separate lazy-loaded CSS files

The idea is that browsing a doc should not load CSS for the homepage, the showcase and other pages of a site


Interesting reads:

Note: Remix also implements some nice system where CSS of a page is inserted when you navigate to a page and removed when you navigate away: https://remix.run/docs/en/v1/guides/styling


This is not something high priority, just something to keep in mind

Self-service

  • I'd be willing to do some initial work on this proposal myself.
@slorber slorber added proposal This issue is a proposal, usually non-trivial change status: needs triage This issue has not been triaged by maintainers and removed status: needs triage This issue has not been triaged by maintainers labels Dec 30, 2021
@Josh-Cena Josh-Cena added the domain: performance Related to bundle size or perf optimization label Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: performance Related to bundle size or perf optimization proposal This issue is a proposal, usually non-trivial change
Projects
None yet
Development

No branches or pull requests

2 participants