FMHYedit/docs/.vitepress/hooks/satoriConfig.ts

48 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2024-01-25 16:32:45 +00:00
import { readFile } from 'node:fs/promises'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import type { SatoriOptions } from 'x-satori/vue'
import { defineSatoriConfig } from 'x-satori/vue'
2023-11-14 17:18:52 +00:00
2024-01-25 16:32:45 +00:00
const __dirname = dirname(fileURLToPath(import.meta.url))
const __fonts = resolve(__dirname, '../fonts')
2023-11-12 16:42:57 +00:00
2024-01-25 16:32:45 +00:00
const fonts: SatoriOptions['fonts'] = [
2023-11-12 16:42:57 +00:00
{
2024-01-25 16:32:45 +00:00
name: 'Inter',
data: await readFile(resolve(__fonts, 'Inter-Regular.otf')),
2023-11-12 16:42:57 +00:00
weight: 400,
2024-01-25 16:32:45 +00:00
style: 'normal'
2023-11-12 16:42:57 +00:00
},
{
2024-01-25 16:32:45 +00:00
name: 'Inter',
data: await readFile(resolve(__fonts, 'Inter-Medium.otf')),
2023-11-12 16:42:57 +00:00
weight: 500,
2024-01-25 16:32:45 +00:00
style: 'normal'
2023-11-12 16:42:57 +00:00
},
{
2024-01-25 16:32:45 +00:00
name: 'Inter',
data: await readFile(resolve(__fonts, 'Inter-SemiBold.otf')),
2023-11-12 16:42:57 +00:00
weight: 600,
2024-01-25 16:32:45 +00:00
style: 'normal'
2023-11-12 16:42:57 +00:00
},
{
2024-01-25 16:32:45 +00:00
name: 'Inter',
data: await readFile(resolve(__fonts, 'Inter-Bold.otf')),
2023-11-12 16:42:57 +00:00
weight: 700,
2024-01-25 16:32:45 +00:00
style: 'normal'
}
]
2023-11-12 16:42:57 +00:00
export default defineSatoriConfig({
width: 1200,
height: 628,
fonts,
props: {
2024-01-25 16:32:45 +00:00
title: 'Title',
2023-11-12 16:42:57 +00:00
description:
2024-01-25 16:32:45 +00:00
'Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint consectetur cupidatat.',
dir: '/j'
}
})