1
Fork 0
moonythm/build.py
prescientmoon 9ffac14e2b
Inital setup
Signed-off-by: prescientmoon <git@moonythm.dev>
2024-10-15 08:01:36 +02:00

17 lines
427 B
Python
Executable file

#!/usr/bin/env nix-shell
#!nix-shell -p python3 -i python3
import shutil
import subprocess
shutil.rmtree("dist", ignore_errors=True)
shutil.copytree("public", "dist")
with open("dist/index.html", "r") as file:
template = file.read()
output = subprocess.check_output("cargo run", shell=True).decode("utf-8")
result = template.replace("$CONTENT", output)
with open("dist/index.html", "w") as file:
file.write(result)