From da0dd81630d11caf541df741270a8a2db168a692 Mon Sep 17 00:00:00 2001 From: Luke Fretwell Date: Sun, 2 Aug 2026 16:28:55 -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 208e4e5..5c92ee2 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 6f498c0..d1cf011 100644 --- a/_includes/js.html +++ b/_includes/js.html @@ -2,9 +2,6 @@