add awsm theme

This commit is contained in:
polv committed 2020-12-15 20:00:14 +07:00
1 parent 7039b10df2
commit e397c9ae1e
15 files changed
+117 -115

No files matched your search

+7 -1
View File
@@ -1,4 +1,5 @@
import fs from 'fs'
import path from 'path'
import yaml from 'js-yaml'
import * as z from 'zod'
@@ -8,6 +9,7 @@ export const THEME_FILENAME = 'theme.yml'
export const zTheme = z
.object({
title: z.string(),
awsm: z.string().optional(),
description: z.string().optional(),
keywords: z.array(z.string()).optional(),
nav: z
@@ -50,6 +52,10 @@ export const zTheme = z
})
.nonstrict()
export type ITheme = z.infer<typeof zTheme>
export function getTheme() {
return zTheme.parse(yaml.safeLoad(fs.readFileSync(THEME_FILENAME, 'utf-8')))
return zTheme.parse(
yaml.safeLoad(fs.readFileSync(path.join('built', THEME_FILENAME), 'utf-8'))
)
}