forked from ansible/jinja-docsite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
36 lines (29 loc) · 1.17 KB
/
build.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os
import shutil
import sass
from pathlib import Path
from staticjinja import Site
from yaml import Loader, load
def data():
return {
"base": load(open("data/base.yaml"), Loader=Loader),
"ecosystem": load(open("data/ecosystem.yaml"), Loader=Loader),
"links": load(open("data/links.yaml"), Loader=Loader),
"pages": load(open("data/pages.yaml"), Loader=Loader),
"platform": load(open("data/platform.yaml"), Loader=Loader),
"controller_archive": load(open("data/controller_archive.yaml"), Loader=Loader),
"controller_i18n_links": load(open("data/controller_i18n_links.yaml"), Loader=Loader),
"controller_translations": load(open("data/controller_translations.yaml"), Loader=Loader)
}
buildpath = Path('build')
if buildpath.exists() and buildpath.is_dir():
shutil.rmtree("build")
if __name__ == "__main__":
site = Site.make_site()
site.outpath="build"
site.contexts=[(".*.html", data)]
# disable automatic reloading
site.render(use_reloader=False)
shutil.copytree('static', 'build/static')
shutil.copytree('oldsite', 'build/oldsite')
sass.compile(dirname=('sass', 'build/static/css'))