Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Rework assets loading to fix splitting CSS chunks #2985

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

sandhose
Copy link
Member

So I had a re-read of the Vite documentation, and applied exactly what they suggest for including assets.

This fixes CSS code splitting, so we can now share most of the CSS between the server-side rendered templates and the SPA

Copy link

cloudflare-workers-and-pages bot commented Jul 19, 2024

Deploying matrix-authentication-service-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 81b74fc
Status: ✅  Deploy successful!
Preview URL: https://73590f37.matrix-authentication-service-docs.pages.dev
Branch Preview URL: https://quenting-merge-assets.matrix-authentication-service-docs.pages.dev

View logs

Copy link
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

admittedly I haven't probed hard to review this, but I'm happy to work on the 'if you tested it works, it works' principle for this.

Would like to understand what is changing about dark mode though

Comment on lines -29 to -41
(function () {
const query = window.matchMedia("(prefers-color-scheme: dark)");
function handleChange(list) {
if (list.matches) {
document.documentElement.classList.add("cpd-theme-dark");
} else {
document.documentElement.classList.remove("cpd-theme-dark");
}
}

query.addEventListener("change", handleChange);
handleChange(query);
})();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we not support dark colour themes anymore? Or is this handled some other way?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do, it's me who misunderstood how the design tokens worked at some point. It defaults to media queries, but you can override the theme by setting the cpd-theme-dark or cpd-theme-light classes.

So this piece of code isn't needed

@sandhose sandhose merged commit e937ea8 into main Jul 25, 2024
16 checks passed
@sandhose sandhose deleted the quenting/merge-assets branch July 29, 2024 12:06
@sandhose sandhose added the A-Frontend Changes on the React frontend label Jul 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Frontend Changes on the React frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants