make.example.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. from pathlib import Path
  2. from json import loads
  3. from shutil import rmtree
  4. from shutil import copytree
  5. from source.cx_maketool import sass_compiler
  6. from source.cx_maketool import esbuild_compiler
  7. from source.cx_maketool import render
  8. from source.cx_maketool import script
  9. from source.cx_maketool import link
  10. root = Path(__file__).absolute()
  11. source = root / Path("source/")
  12. build = root / Path("build/")
  13. views = source / Path("views/")
  14. styles = source / Path("theme/")
  15. scripts = source / Path("scripts/")
  16. assets = source / Path("assets/")
  17. bundles = build / Path("bundle/")
  18. assets_output = build / Path("assets/")
  19. index = views / Path("core.html")
  20. scripts_loader = scripts / Path("code.js")
  21. theme_loader = styles / Path("core.sass")
  22. index_output = build / Path("index.html")
  23. script_bundle = bundle / Path("app.js")
  24. theme_bundle = bundle / Path("theme.css")
  25. if build.exists():
  26. rmtree(build)
  27. build.mkdir()
  28. bundles.mkdir()
  29. sass_compiler(theme_loader).build(theme_bundle)
  30. esbuild_compiler(scripts_loader).build(script_bundle)
  31. copytree(assets, assets_output)
  32. copytree(config, config_output)