diff --git a/web/src/app.html b/web/src/app.html index 9ae4dbd4..12cede3e 100644 --- a/web/src/app.html +++ b/web/src/app.html @@ -25,6 +25,7 @@ href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500&family=Inter:wght@400;500&family=JetBrains+Mono:wght@400;500&display=swap" /> %sveltekit.head% +
%sveltekit.body%
diff --git a/web/vite.config.ts b/web/vite.config.ts index 068a5570..c20b0fee 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -9,8 +9,34 @@ const tokensPlugin = { } }; +// Build-only plugin that injects Go html/template tokens into the +// rendered index.html so the runtime Go server can substitute per- +// instance branding. In dev (`vite dev`), the marker stays as a +// comment and the SPA falls back to the literal app.html title. +const injectGoTokensPlugin = { + name: 'minstrel-inject-go-tokens', + apply: 'build' as const, + enforce: 'post' as const, + transformIndexHtml(html: string) { + const titleTag = `{{ .AppName }}`; + const headBlock = ` + + + + + + + + + `; + return html + .replace('Minstrel', titleTag) + .replace('', headBlock); + } +}; + export default defineConfig({ - plugins: [tokensPlugin, sveltekit()], + plugins: [tokensPlugin, sveltekit(), injectGoTokensPlugin], server: { port: 5173, proxy: {