From e3d9e7f955f3f08cb2e69d469ece354526d46c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A7=80=EC=98=81?= <본인 이메일m17208.tdc.hanmacgroup@gmail.com> Date: Tue, 20 Oct 2026 14:50:06 +0900 Subject: [PATCH] =?UTF-8?q?BLOCK8=20=EB=AA=A8=EB=8D=B8=20=EB=8B=A8?= =?UTF-8?q?=EB=8F=85=20=EC=8B=A4=ED=96=89=20HTML=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/BLOCK8_모델웹페이지.html | 24 ++++++++++++ scripts/build_standalone_html.py | 63 ++++++++++++++++++++++++++++++++ src/App.jsx | 1 + 3 files changed, 88 insertions(+) create mode 100644 public/BLOCK8_모델웹페이지.html create mode 100644 scripts/build_standalone_html.py diff --git a/public/BLOCK8_모델웹페이지.html b/public/BLOCK8_모델웹페이지.html new file mode 100644 index 0000000..b01d4d1 --- /dev/null +++ b/public/BLOCK8_모델웹페이지.html @@ -0,0 +1,24 @@ + + + + + + + + 광터지하차도 BLOCK8 3D 모델 + + + +
+ + + diff --git a/scripts/build_standalone_html.py b/scripts/build_standalone_html.py new file mode 100644 index 0000000..6200791 --- /dev/null +++ b/scripts/build_standalone_html.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +"""Vite 빌드 결과를 독립 실행 가능한 BLOCK8 HTML로 묶는다.""" + +from html.parser import HTMLParser +from pathlib import Path +import re + +ROOT = Path(__file__).resolve().parents[1] +DIST = ROOT / "dist" +OUTPUT = ROOT / "public/BLOCK8_모델웹페이지.html" + + +class AssetParser(HTMLParser): + def __init__(self): + super().__init__() + self.script = None + self.stylesheet = None + + def handle_starttag(self, tag, attrs): + values = dict(attrs) + if tag == "script" and values.get("src", "").startswith("/assets/"): + self.script = values["src"].split("/assets/", 1)[1] + if tag == "link" and values.get("rel") == "stylesheet" and values.get("href", "").startswith("/assets/"): + self.stylesheet = values["href"].split("/assets/", 1)[1] + + +def main(): + index = (DIST / "index.html").read_text(encoding="utf-8") + parser = AssetParser() + parser.feed(index) + if not parser.script or not parser.stylesheet: + raise RuntimeError("빌드된 HTML에서 JavaScript/CSS 파일을 찾지 못했습니다. npm run build를 먼저 실행하세요.") + + js = (DIST / "assets" / parser.script).read_text(encoding="utf-8") + css = (DIST / "assets" / parser.stylesheet).read_text(encoding="utf-8") + # public 폴더 안의 자료 링크가 file:// 환경에서도 열리도록 상대 경로로 바꾼다. + for path in ("analysis/", "drawings/", "BLOCK8_", "작업기록.txt"): + js = js.replace(f"/{path}", f"./{path}") + + title = re.search(r"(.*?)", index, re.DOTALL) + page_title = title.group(1) if title else "광터지하차도 BLOCK8 3D 모델" + html = f''' + + + + + + + {page_title} + + + +
+ + + +''' + OUTPUT.write_text(html, encoding="utf-8") + print(f"{OUTPUT.relative_to(ROOT)} 생성 완료 ({OUTPUT.stat().st_size:,} bytes)") + + +if __name__ == "__main__": + main() diff --git a/src/App.jsx b/src/App.jsx index 2117e6b..bd186b1 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -58,6 +58,7 @@ export default function App() { 분석 파일 ↗ 인수인계 파일 ↗ 커밋 기록 ↗ + 단독 HTML ↗ 작업 로그 ↗ 원본 DXF ↓