Implement custom fonts

This commit is contained in:
Wolfgang Huß 2024-04-22 12:22:16 +02:00
parent 7295dfd205
commit 1139983096
4 changed files with 11 additions and 20 deletions

View File

@ -1,3 +1,4 @@
import { getDirname, path } from "vuepress/utils"
import { defineUserConfig } from 'vuepress' import { defineUserConfig } from 'vuepress'
import { viteBundler } from '@vuepress/bundler-vite' import { viteBundler } from '@vuepress/bundler-vite'
@ -5,30 +6,20 @@ import meta from './config/meta'
import theme from './config/theme' import theme from './config/theme'
import plugins from './config/plugins' import plugins from './config/plugins'
const __dirname = getDirname(import.meta.url)
export default defineUserConfig({ export default defineUserConfig({
...meta, ...meta,
theme, theme,
plugins, plugins,
bundler: viteBundler(), bundler: viteBundler(),
base: process.env.VUEPRESS_BASE ? `/${process.env.VUEPRESS_BASE}/` : '/', base: process.env.VUEPRESS_BASE ? `/${process.env.VUEPRESS_BASE}/` : '/',
head: [ alias: {
[ '@theme': path.resolve(
"link", __dirname,
{ './theme',
// href: "https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;700&display=swap", ),
href: "public/fonts/Noto_Sans/NotoSans-Regular.ttf", },
rel: "stylesheet",
},
],
[
"link",
{
// href: "https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;700&display=swap",
href: "public/fonts/Noto_Sans/NotoSans-Bold.ttf",
rel: "stylesheet",
},
],
],
locales: { locales: {
// The key is the path for the locale to be nested under. // The key is the path for the locale to be nested under.
// As a special case, the default locale can use '/' as its path. // As a special case, the default locale can use '/' as its path.

View File

@ -2,13 +2,13 @@
font-family: 'Noto Sans'; font-family: 'Noto Sans';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: url('fonts/Noto_Sans/NotoSans-Regular.ttf'); src: url('@theme/assets/fonts/Noto_Sans/NotoSans-Regular.ttf');
} }
@font-face { @font-face {
font-family: 'Noto Sans Bold'; font-family: 'Noto Sans Bold';
font-style: bold; font-style: bold;
font-weight: 600; font-weight: 600;
src: url('fonts/Noto_Sans/NotoSans-Bold.ttf'); src: url('@theme/assets/fonts/Noto_Sans/NotoSans-Bold.ttf');
} }
// $font-family: XXX; // $font-family: XXX;