v64: рефакторинг — разбил монолит на css/ js/ build.sh dist/ (781→43 строки index.html)

This commit is contained in:
“Naeel”
2026-05-22 18:39:13 +04:00
parent bd042be61c
commit 9c13c21898
11 changed files with 1516 additions and 747 deletions
Executable
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env python3
"""Склеивает CSS/JS в единый index.html для деплоя (ConfigMap — один файл)."""
import os
BASE = os.path.dirname(os.path.abspath(__file__))
html = open(os.path.join(BASE, 'index.html')).read()
css = open(os.path.join(BASE, 'css/style.css')).read()
html = html.replace('<link rel="stylesheet" href="css/style.css">',
f'<style>\n{css}\n</style>')
for jsf in ['storage.js', 'syllables.js', 'transcribe.js', 'audio.js', 'compare.js', 'main.js']:
js = open(os.path.join(BASE, 'js', jsf)).read()
html = html.replace(f'<script src="js/{jsf}"></script>',
f'<script>\n{js}\n</script>')
os.makedirs(os.path.join(BASE, 'dist'), exist_ok=True)
with open(os.path.join(BASE, 'dist/index.html'), 'w') as f:
f.write(html)
print(f'dist/index.html ready ({len(html)} bytes)')