-
Notifications
You must be signed in to change notification settings - Fork 32
Rework assets loading to fix splitting CSS chunks #2985
Conversation
Deploying matrix-authentication-service-docs with Cloudflare Pages
|
affe69f
to
81b74fc
Compare
There was a problem hiding this 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
(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); | ||
})(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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