todo/build.py

42 lines
723 B
Python
Raw Normal View History

2024-12-09 00:19:40 +00:00
#! /usr/bin/env python3
"""Build web."""
from pathlib import Path
2024-12-09 12:10:43 +00:00
from rwx.fs import make_directory, read_file_text, write
from rwx.ps import run
2024-12-09 00:19:40 +00:00
if __name__ == "__main__":
2024-12-09 12:10:43 +00:00
root = Path(__file__).parent
out = root / "out" / "web"
gv = root / "index.gv"
svg = out / "index.svg"
2024-12-09 00:19:40 +00:00
make_directory(out)
2024-12-09 12:10:43 +00:00
run("dot", str(gv), "-Tsvg", "-o", str(svg))
text = read_file_text(svg)
2024-12-11 20:21:49 +00:00
write(
out / "index.css",
"""\
2024-12-09 18:47:51 +00:00
html {
background-color: #202020;
}
2024-12-11 20:21:49 +00:00
""",
)
write(
out / "index.html",
f"""\
2024-12-09 12:10:43 +00:00
<!DOCTYPE html>
<html><head>
<meta charset="UTF-8">
2024-12-09 18:47:51 +00:00
<link rel="stylesheet" href="index.css">
<title>todo.rwx.work</title>
2024-12-09 12:10:43 +00:00
</head><body>
{text}
</body></html>
2024-12-11 20:21:49 +00:00
""",
)