Tooling:
nix/direnv to ensure dependencies are present
jinja-based templating to avoid duplication of common sections of pages
(header and footer, primarily)
auto-rebuilding server for rapid iteration
22 lines
466 B
Makefile
22 lines
466 B
Makefile
dir:
|
|
mkdir -p build
|
|
|
|
template: dir
|
|
#!/usr/bin/env python3
|
|
from jinja2 import Environment, FileSystemLoader
|
|
from glob import glob
|
|
env = Environment(loader=FileSystemLoader('.'))
|
|
for file in glob("*", root_dir="pages/"):
|
|
with open(f"build/{file}", "w") as out:
|
|
out.write(env.get_template(f"pages/{file}").render())
|
|
|
|
build: template
|
|
cp -r static/ build/
|
|
|
|
serve: build
|
|
simple-http-server --index --nocache build/
|
|
|
|
watch:
|
|
watchexec --restart -- just serve
|
|
|