diff --git a/src/render_site.py b/src/render_site.py index edfe8e4..3fa6436 100644 --- a/src/render_site.py +++ b/src/render_site.py @@ -1,4 +1,5 @@ import dataclasses +import json import shutil from pathlib import Path from typing import Dict, List @@ -608,6 +609,13 @@ def render_main_site(env: jinja2.Environment, out_dir: Path): with open(output_file, 'w') as f: f.write(rendered_html) + + # Add API endpoint + output_file = out_dir / 'api' / 'export' / 'games' / 'index.html' + output_file.parent.mkdir(exist_ok=True, parents=True) + with open(output_file, 'w') as f: + json.dump([dataclasses.asdict(g) for g in games], f) + # Copy CSS to output directory shutil.copytree('css', 'build/css', dirs_exist_ok=True) shutil.copytree('deps/tabulator/dist/css', 'build/css', dirs_exist_ok=True)