histoire
Version:
A fast story book powered by Vite
13 lines (11 loc) • 460 B
text/typescript
import type { Context } from '../context.js'
export function resolvedConfig(ctx: Context) {
let js = `export const config = ${JSON.stringify(ctx.config)}\n`
if (ctx.config.theme?.logo) {
for (const key in ctx.config.theme.logo) {
js += `import Logo_${key} from '${ctx.config.theme.logo[key]}'\n`
}
}
js += `export const logos = {${Object.keys(ctx.config.theme?.logo ?? {}).map(key => `${key}: Logo_${key}`).join(', ')}}\n`
return js
}