|
|
@@ -0,0 +1,52 @@
|
|
|
+#!/usr/bin/python
|
|
|
+
|
|
|
+from pathlib import Path
|
|
|
+from json import loads
|
|
|
+from shutil import rmtree
|
|
|
+from shutil import copytree
|
|
|
+
|
|
|
+from cx_maketool import sass_compiler
|
|
|
+from cx_maketool import esbuild_compiler
|
|
|
+from cx_maketool import render
|
|
|
+from cx_maketool import script
|
|
|
+from cx_maketool import link
|
|
|
+
|
|
|
+root = Path(__file__).absolute().parent
|
|
|
+source = root / Path("source/")
|
|
|
+build = root / Path("./")
|
|
|
+
|
|
|
+styles = source / Path("stylesheet/")
|
|
|
+scripts = source / Path("scripts/")
|
|
|
+assets = source / Path("assets/")
|
|
|
+
|
|
|
+assets_output = build / Path("assets/")
|
|
|
+
|
|
|
+scripts_loader = scripts / Path("core.js")
|
|
|
+theme_loader = styles / Path("core.sass")
|
|
|
+info_file = source / Path("about.txt")
|
|
|
+
|
|
|
+script_bundle = build / Path("script.js")
|
|
|
+theme_bundle = build / Path("style.css")
|
|
|
+
|
|
|
+if theme_bundle.is_file():
|
|
|
+ theme_bundle.unlink()
|
|
|
+
|
|
|
+if script_bundle.is_file():
|
|
|
+ script_bundle.unlink()
|
|
|
+
|
|
|
+sass_compiler(theme_loader).build(theme_bundle)
|
|
|
+esbuild_compiler(scripts_loader).build(script_bundle)
|
|
|
+
|
|
|
+if assets_output.exists():
|
|
|
+ rmtree(assets_output)
|
|
|
+
|
|
|
+copytree(assets, assets_output)
|
|
|
+
|
|
|
+with info_file.open() as info:
|
|
|
+ info_content = info.read()
|
|
|
+
|
|
|
+with theme_bundle.open() as theme:
|
|
|
+ content = theme.read()
|
|
|
+
|
|
|
+with theme_bundle.open("w") as theme:
|
|
|
+ theme.write(info_content + content)
|