General fixes

This commit is contained in:
naielv
2025-07-31 16:43:01 +02:00
parent a274de3c4d
commit a016e06557
15 changed files with 176 additions and 248 deletions

View File

@@ -1,10 +1,23 @@
import json
import os
def get_all_files(directory):
files = []
for root, _, filenames in os.walk(directory):
for filename in filenames:
path = os.path.join(root, filename)
# Convert to relative path and normalize separators
rel_path = os.path.relpath(path, directory)
files.append(rel_path.replace('\\', '/'))
return files
PREFETCH = ""
VERSIONCO = "2025-07-30_4"
HANDLEPARSE = os.listdir("src/")
ASSETS = json.load(open("_assets.json", "r")) + HANDLEPARSE
HANDLEPARSE = get_all_files("src")
# Combine assets from JSON and recursively found files
ASSETS = get_all_files("assets")
for asset in ASSETS:
if asset != "sw.js":
PREFETCH += f'<link rel="prefetch" href="{asset}" />\n'
@@ -18,7 +31,8 @@ def replace_handles(string):
for file in HANDLEPARSE:
with open("src/" + file, "r") as f:
out = replace_handles(f.read())
with open("dist/" + file, "w") as f:
f.write(out)
print(file)
with open("src/" + file, "r") as f1:
out = replace_handles(f1.read())
with open("dist/" + file, "w") as f2:
f2.write(out)