| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 | #!/bin/pythonfrom pathlib import Pathfrom json import loadsfrom shutil import rmtreefrom shutil import copytreefrom shutil import copyfrom maketool import sass_compilerfrom maketool import esbuild_compilerfrom maketool import renderfrom maketool import scriptfrom maketool import linkroot = Path(__file__).absolute().parentsource = root / Path("application/")build = root / Path("static/")views = source / Path("views/")styles = source / Path("theme/")scripts = source / Path("scripts/")assets = source / Path("assets/")bundle = build / Path("bundle/")assets_output = build / Path("assets/")scripts_loader = scripts / Path("core.js")theme_loader = styles / Path("core.sass")script_bundle = bundle / Path("app.js")theme_bundle = bundle / Path("theme.css")if build.exists():    rmtree(build)build.mkdir()bundle.mkdir()sass_compiler(theme_loader).build(theme_bundle)esbuild_compiler(scripts_loader).build(script_bundle)copytree(assets, assets_output)for view in views.iterdir():    if not view.is_file():        continue    if str(view.suffix) != ".html":        continue    copy(view, build / Path(view.name))            
 |