General fixes
This commit is contained in:
26
build.py
26
build.py
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user