Files
as-talange/fix_htmx.py

15 lines
557 B
Python

import os
import glob
template_dir = "/home/ucef/.gemini/antigravity/scratch/as-talange/as-talange-web/src/main/resources/templates"
html_files = glob.glob(template_dir + "/**/*.html", recursive=True)
for file in html_files:
with open(file, "r") as f:
content = f.read()
if "htmx.org" not in content and "<head>" in content:
content = content.replace("<head>", "<head>\n <script src=\"https://unpkg.com/htmx.org@1.9.11\"></script>")
with open(file, "w") as f:
f.write(content)
print(f"Fixed {file}")