Initial Setup
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
This commit is contained in:
21
justfile
Normal file
21
justfile
Normal file
@@ -0,0 +1,21 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user