From 672ce3d0d04c904dd754bb1414d3c37954116327 Mon Sep 17 00:00:00 2001 From: Luke Fretwell Date: Sun, 2 Aug 2026 16:28:56 -0700 Subject: [PATCH 1/2] Fix theme reverting to dark on Eleventy dev-server live-reload The dev server's DOM-morph reload strips the data-bs-theme attribute (matchRootAttributes syncs to the freshly server-rendered HTML, which never has this client-only attribute). Consolidate the theme script into a self-healing version: sets theme on load, re-syncs on OS change, and adds a MutationObserver that restores the attribute the instant anything strips it. Removes the now-redundant duplicate matchMedia listener from js.html. --- _includes/header.html | 15 ++++++++++++++- _includes/js.html | 3 --- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/_includes/header.html b/_includes/header.html index 208e4e50..5c92ee22 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -72,7 +72,20 @@ {% include "favicon.html" %} {% include "style.html" %} diff --git a/_includes/js.html b/_includes/js.html index 6f498c01..d1cf0117 100644 --- a/_includes/js.html +++ b/_includes/js.html @@ -2,9 +2,6 @@