From 6de03078564ac4511c255b8c8da07794eb8ee5db Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Sun, 16 Aug 2026 19:51:17 +0000 Subject: [PATCH] Split CSS into base and theme, link them separately - Move shared structural styles to frontend/src/assets/pagerite.css with conservative variables, and purple theme overrides to frontend/src/assets/themes/purple/theme.css. - Backend now links the base and theme stylesheets as separate files so they can be swapped or augmented. - Add blocking="render" to stylesheet links to avoid FOUC. - Drop redundant defer from module script tags. - Update related docs and comments. --- AGENTS.md | 14 +- docs/design-principles.md | 8 +- frontend/src/PageEditor.vue | 2 +- frontend/src/SiteEditor.vue | 2 +- .../src/assets/{style.css => pagerite.css} | 32 ++--- frontend/src/assets/themes/purple/theme.css | 34 +++++ frontend/src/main.js | 7 +- frontend/src/pagerite.js | 9 +- frontend/vite.config.js | 2 + pagerite/views.py | 128 ++++++++++++++---- 10 files changed, 173 insertions(+), 65 deletions(-) rename frontend/src/assets/{style.css => pagerite.css} (96%) create mode 100644 frontend/src/assets/themes/purple/theme.css diff --git a/AGENTS.md b/AGENTS.md index 257509c..b19b1ae 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -76,15 +76,17 @@ not for the public pages. See `docs/design-principles.md` for the design. database (never overwrites existing pages). - `frontend/src/` — the Vue editor and public-page entries. - `main.js` — Vue editor app entry, mounts PageEditor/SiteEditor. - - `pagerite.js` — public page entry; imports the shared style and runs - fetch-navigation, scroll-reveal and code copy buttons. + - `pagerite.js` — public page entry; runs fetch-navigation, scroll-reveal and + code copy buttons. The backend links the shared CSS as two separate + stylesheets (base and theme) so they can be swapped or augmented. - `assets/` — shared styles and data files built by Vite and served hashed - under `/_/assets/`: `style.css`, `pygments.css`, `banner.svg` and - `fonts/` (self-hosted Fraunces/Literata/Fira Code variable woff2). The - `::view-transition*` block at the end of `style.css` (from + under `/_/assets/`: `pagerite.css` (base layout + conservative variables), + `themes/purple/theme.css` (the purple/dark theme override), `pygments.css`, + `banner.svg` and `fonts/` (self-hosted Fraunces/Literata/Fira Code variable + woff2). The `::view-transition*` block at the end of `pagerite.css` (from termotohtori.fi) is fragile — do not tweak. - Vite builds ES-module `.js` outputs; the backend renders `