aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar hedy <[email protected]>2024-01-18 12:51:17 +0800
committerGravatar hedy <[email protected]>2024-01-18 12:51:17 +0800
commitf0a5da2bf84818f2ac72b6272ee674bef6e6134c (patch)
treeac63094209268d2ecf3584f5928c060da38b2b60
parentDark: More subtle collapsible and box-shadow borders (diff)
Optimistic fix for FOUC on initial site load
-rw-r--r--pydis_site/static/js/base/themes.js4
-rw-r--r--pydis_site/templates/base/base.html1
2 files changed, 5 insertions, 0 deletions
diff --git a/pydis_site/static/js/base/themes.js b/pydis_site/static/js/base/themes.js
index fa7b9cf6..f79b759d 100644
--- a/pydis_site/static/js/base/themes.js
+++ b/pydis_site/static/js/base/themes.js
@@ -3,6 +3,10 @@
const defaultTheme = "light";
const stylesheet = document.getElementById("bulma-css");
+// We include the dark stylesheet in base template to include the rel="preload",
+// but remove the actual rel="stylesheet" element here because we won't need it.
+document.getElementById("bulma-css-dark").remove();
+
// Get saved preference for the site in local storage, optionally accounting
// for system preference used when a page loads.
function getCurrentTheme(systemPrefers) {
diff --git a/pydis_site/templates/base/base.html b/pydis_site/templates/base/base.html
index bf58fb05..e497298a 100644
--- a/pydis_site/templates/base/base.html
+++ b/pydis_site/templates/base/base.html
@@ -24,6 +24,7 @@
<title>Python Discord | {% block title %}Website{% endblock %}</title>
{% bulma %}
+ {% bulma 'dark' include_js=False %}
{% font_awesome %}
<link rel="stylesheet" href="{% static "css/base/base.css" %}">