File size: 537 Bytes
64377a9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | """把 demo 打包成单文件 HTML(内联 CSS/JS/数据)。"""
import pathlib
base = pathlib.Path(__file__).parent
html = (base / "demo/index.html").read_text()
app = (base / "demo/app.js").read_text()
data = (base / "demo/data.js").read_text()
html = html.replace('<script src="data.js"></script>', "<script>\n" + data + "\n</script>")
html = html.replace('<script src="app.js"></script>', "<script>\n" + app + "\n</script>")
out = base / "demo/cdhe-monitor.html"
out.write_text(html)
print(out, round(len(html) / 1e6, 2), "MB")
|