"""把 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('', "") html = html.replace('', "") out = base / "demo/cdhe-monitor.html" out.write_text(html) print(out, round(len(html) / 1e6, 2), "MB")