-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.py
51 lines (40 loc) · 1 KB
/
deploy.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python3
import os
from lettersmith import *
import config
environment = os.getenv('BUILD_ENV', 'deploy')
build_config = config.deploy if environment == 'deploy' else config.development
base_url = build_config.base_url
site_title = 'Tactical Typos'
static = files.find('static/**/*')
pages = pipe(
docs.find('**/*.md'),
docs.remove_index,
docs.remove_drafts,
permalink.rel_page_permalink('.'),
docs.uplift_frontmatter,
docs.with_template('page.html'),
)
home = pipe(
docs.find('index.md'),
permalink.rel_page_permalink('.'),
docs.uplift_frontmatter,
docs.with_template('index.html'),
)
all_pages = pipe(
(*pages, *home),
wikidoc.content_markdown(base_url),
# absolutize.absolutize(base_url),
)
context = {
'site': {
'title': site_title,
},
'base_url': base_url
}
rendered_docs = pipe(
(all_pages),
jinjatools.jinja('templates', base_url, context)
)
write(chain(static, rendered_docs), directory='public')
print('Done!')