feat: extend asset copying to include data directory
All checks were successful
Build and Deploy Static Site / build (push) Successful in 58s

Expanded the asset copying functionality to also handle the 'data' directory in addition to the 'assets' folder. This ensures that both static assets and data files are included in the output directory, streamlining the build process and ensuring all necessary resources are available in the generated static site.
This commit is contained in:
Kumi 2024-07-01 12:12:39 +02:00
parent d57046fa57
commit ee2d53a36d
Signed by: kumi
GPG key ID: ECBCC9082395383F

11
main.py
View file

@ -129,11 +129,12 @@ def generate_static_site(development_mode=False):
f.write(response) f.write(response)
# Copy static assets # Copy static assets
assets_src = pathlib.Path("assets") for folder in ["assets", "data"]:
assets_dst = output_dir / "assets" src = pathlib.Path(folder)
if assets_dst.exists(): dst = output_dir / folder
shutil.rmtree(assets_dst) if dst.exists():
shutil.copytree(assets_src, assets_dst) shutil.rmtree(dst)
shutil.copytree(src, dst)
print("Static site generated successfully.") print("Static site generated successfully.")