diff --git a/.gitignore b/.gitignore index 15813be..81dd746 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ package-lock.json node_modules/ +*.~undo-tree~ diff --git a/Makefile b/Makefile index e69de29..cc8b31e 100644 --- a/Makefile +++ b/Makefile @@ -0,0 +1,5 @@ +build/index.html: build/style.css index.html config.toml compile.js + node compile.js + +build/style.css: scss/style.scss + npx sass $< $@ diff --git a/compile.js b/compile.js index e69de29..2f1d073 100644 --- a/compile.js +++ b/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(); diff --git a/config.toml b/config.toml index e69de29..6a252af 100644 --- a/config.toml +++ b/config.toml @@ -0,0 +1 @@ +title = "Dan Jones's Links" diff --git a/index.html b/index.html index e69de29..fb567e3 100644 --- a/index.html +++ b/index.html @@ -0,0 +1,8 @@ + + +
+ +