refactor(web): drive vite-injected theme-color from tokens.json (#375)

Closes the last theme-color hardcode. Runtime side already imports
tokens.colors.{dark,light}.obsidian via applyMetaThemeColor; build
side now matches via JSON import-attributes. Drops the // TODO(#375)
tripwire.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-10 15:29:48 -04:00
parent 65057473c6
commit 714039bae5
+6 -3
View File
@@ -1,6 +1,10 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { execSync } from 'node:child_process';
import tokens from './src/lib/styles/tokens.json' with { type: 'json' };
const THEME_DARK = tokens.colors.dark.obsidian;
const THEME_LIGHT = tokens.colors.light.obsidian;
const tokensPlugin = {
name: 'minstrel-tokens',
@@ -29,9 +33,8 @@ const injectGoTokensPlugin = {
<meta property="og:image" content="/brand/og-image.png">
<meta property="og:type" content="website">
<meta name="twitter:card" content="summary_large_image">
<!-- TODO(#375): keep theme-color hex in sync with tokens.json colors.dark.obsidian / colors.light.obsidian -->
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#14171A">
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#F8F5EE">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="${THEME_DARK}">
<meta name="theme-color" media="(prefers-color-scheme: light)" content="${THEME_LIGHT}">
<script>window.__MINSTREL__ = { appName: "{{ .AppName }}" };</script>`;
// Fail loudly if either anchor drifts. A silent .replace() no-op