15 lines
846 B
Python
15 lines
846 B
Python
#!/usr/bin/env python3
|
|
"""Собирает web/calc-standalone.html — один self-contained файл (inline CSS+JS)."""
|
|
import pathlib
|
|
web = pathlib.Path(__file__).parent
|
|
html = (web / "index.html").read_text(encoding="utf-8")
|
|
css = (web / "style.css").read_text(encoding="utf-8")
|
|
js = (web / "engine.js").read_text(encoding="utf-8") + "\n" + (web / "app.js").read_text(encoding="utf-8")
|
|
html = html.replace('<link rel="stylesheet" href="style.css">', f"<style>\n{css}</style>")
|
|
html = html.replace('<script src="engine.js"></script>\n<script src="app.js"></script>',
|
|
f"<script>\n{js}\n</script>")
|
|
assert "href=\"style.css\"" not in html and "src=\"app.js\"" not in html and "src=\"engine.js\"" not in html
|
|
out = web / "calc-standalone.html"
|
|
out.write_text(html, encoding="utf-8")
|
|
print(out, out.stat().st_size, "bytes")
|