-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot.ls
67 lines (57 loc) · 1.26 KB
/
boot.ls
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Paths = await m.fetch \paths.json \json
globs = <[
/comps/both/*
/comps/main/!(OS.ls)
/comps/main/OS.ls
/comps/frme/*
/code/both.ls
/code/main.ls
/code/frme.ls
/styl/decr.styl
/styl/both.styl
/styl/main.styl
/styl/frme.styl
/frme.html
]>
data = await Promise.all globs.map (glob) ~>
glob = Paths[glob] or glob
if Array.isArray glob
Promise.all glob.map (path) ~>
m.fetch path
else
m.fetch glob
compsB = data.0.join ""
compsM = data[1 2]flat!join ""
compsF = data.3.join ""
codeB = data.4
codeM = data.5
codeF = data.6
stylD = data.7
stylB = data.8
stylM = data.9
stylF = data.10
htmlF = data.11
function indent text, space
skipFirstLine = yes
text.replace /^(?=.)/gm ~>
if skipFirstLine
skipFirstLine = no
""
else space
importVarCode = """
text => text.replace(/(^ +)?\\{\\{([\\w@.]+)}}/gm, (_, space, name) => {
name = name.replace("@", "this.");
let val = eval(name);
if (space) val = indent(val, space);
return val;
});
"""
importVar = eval importVarCode
code = importVar codeM
code = importVar codeB
code = livescript.compile code
eval code
styl = stylM
styl = importVar stylB
styl = stylus.render styl, compress: yes
stylEl.textContent = styl