59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import { fonts } from './utils/fonts'
|
|
|
|
export default defineNuxtConfig({
|
|
compatibilityDate: '2024-04-03',
|
|
devtools: { enabled: true },
|
|
modules: ['@unocss/nuxt', '@vueuse/nuxt', '@nuxt/eslint'],
|
|
eslint: {
|
|
config: {
|
|
stylistic: {
|
|
quoteProps: 'as-needed',
|
|
},
|
|
},
|
|
},
|
|
app: {
|
|
head: {
|
|
style: [
|
|
{
|
|
children: Object.entries(fonts)
|
|
.map(([className, fontFamily]) => /* css */ `.${className} { font-family: '${fontFamily.name}', monospace; }`)
|
|
.join('\n'),
|
|
},
|
|
],
|
|
link: [
|
|
{
|
|
rel: 'preconnect',
|
|
href: 'https://fonts.bunny.net',
|
|
},
|
|
{
|
|
rel: 'stylesheet',
|
|
href: `https://fonts.bunny.net/css?family=${Object.values(fonts).map(({ link }) => link).join('|')}`,
|
|
},
|
|
],
|
|
script: [
|
|
{
|
|
type: 'text/javascript',
|
|
innerHTML: /* js */ `
|
|
const theme = localStorage.getItem('theme')
|
|
|
|
if (theme === 'system' || !theme)
|
|
document.body.classList.add(
|
|
window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
? 'dark'
|
|
: 'light'
|
|
)
|
|
else
|
|
document.body.classList.add(theme)
|
|
|
|
const font = localStorage.getItem('font')
|
|
|
|
if (font)
|
|
document.body.classList.add(font)
|
|
`,
|
|
tagPosition: 'bodyClose',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
})
|