Files
mathew/frontend/nuxt.config.ts
2026-09-30 01:49:35 +02:00

68 lines
2.7 KiB
TypeScript

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2025-07-15',
devtools: { enabled: true },
modules: ['@nuxtjs/i18n'],
css: ['katex/dist/katex.min.css', '~/assets/css/main.scss'],
/* The interface language (app -> t('...'), catalogues in i18n/locales/).
It is a preference, never part of the address — /wiki/<lang>/<slug>
speaks of the *article's* language, so the UI stays unprefixed.
On a first load the saved choice comes from the `mathew-locale` cookie
(which the server can read, so pages render in the right language before
any script runs), then the browser's own. A signed-in account's stored
choice is applied over these at startup — see app/plugins/auth.ts. */
i18n: {
strategy: 'no_prefix',
defaultLocale: 'en',
locales: [
{ code: 'en', language: 'en-US', name: 'English', file: 'en.json' },
{ code: 'es', language: 'es-ES', name: 'Español', file: 'es.json' },
{ code: 'ca', language: 'ca-ES', name: 'Català', file: 'ca.json' },
{ code: 'fr', language: 'fr-FR', name: 'Français', file: 'fr.json' },
{ code: 'de', language: 'de-DE', name: 'Deutsch', file: 'de.json' },
],
// The catalogues are small; bundling them keeps locale switches instant
lazy: false,
// Messages carry their own markup (<code> in the API banner, the hero
// gradient, demo words in the cheatsheet), rendered with v-html
compilation: { strictMessage: false },
detectBrowserLanguage: {
useCookie: true,
cookieKey: 'mathew-locale',
fallbackLocale: 'en',
},
},
runtimeConfig: {
public: {
// Override with NUXT_PUBLIC_API_BASE in production
apiBase: process.env.NUXT_PUBLIC_API_BASE || 'http://localhost:5000',
},
},
app: {
head: {
meta: [
{
name: 'description',
content: 'A modern, collaborative wiki for mathematical concepts — written in Markdown, rendered with LaTeX.',
},
{ name: 'theme-color', media: '(prefers-color-scheme: light)', content: '#f7f8fb' },
{ name: 'theme-color', media: '(prefers-color-scheme: dark)', content: '#0a0c12' },
],
script: [
{
// Apply saved theme & accent before first paint to avoid a flash
tagPosition: 'head',
innerHTML:
"(function(){try{var d=document.documentElement;var s=localStorage.getItem('mathew-theme');var t=s||(window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light');d.setAttribute('data-theme',t);var a=localStorage.getItem('mathew-accent');if(a&&a!=='violet')d.setAttribute('data-accent',a);}catch(e){}})();",
},
],
},
},
})