aboutsummaryrefslogtreecommitdiffstats
path: root/app/builder/render.ts
blob: 28c6d8017361fd679ffb61357993ceb0c1a83d85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { Page, PageDirectory } from "./pages";
import ejs from 'ejs';
import path from 'path';

export async function render(page: Page, pageDirectory: PageDirectory): Promise<string> {
    const options = {
        page: page,
        site: {
            pages: pageDirectory,
        }
    };
    return await ejs.renderFile(path.join(process.env.VIEWS_DIR, `${page.view}.ejs`), options);
}