👷 Build system works
This commit is contained in:
parent
998ce2c135
commit
4addbac3fb
6 changed files with 37 additions and 2 deletions
20
compile.js
20
compile.js
|
|
@ -0,0 +1,20 @@
|
|||
const { parse } = require('@ltd/j-toml');
|
||||
const { render } = require('mustache');
|
||||
const { readFile, writeFile } = require('node:fs/promises');
|
||||
const { resolve } = require('node:path');
|
||||
|
||||
async function compile() {
|
||||
const confPath = resolve('./config.toml');
|
||||
const confToml = await readFile(confPath, { encoding: 'utf8' });
|
||||
const config = parse(confToml);
|
||||
|
||||
const tempPath = resolve('./index.html');
|
||||
const template = await readFile(tempPath, { encoding: 'utf8' });
|
||||
|
||||
const out = render(template, config);
|
||||
const outPath = resolve('./build/index.html');
|
||||
|
||||
await writeFile(outPath, out);
|
||||
}
|
||||
|
||||
compile();
|
||||
Loading…
Add table
Add a link
Reference in a new issue