-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgenerate_static_lua.sh
More file actions
executable file
·52 lines (48 loc) · 889 Bytes
/
generate_static_lua.sh
File metadata and controls
executable file
·52 lines (48 loc) · 889 Bytes
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
#! /bin/bash
CSS=""
JS=""
HTML=""
OUT_FILE="$2"
for entry in "$1"/*
do
if [[ $entry == *.css ]]
then
CSS="$(cat "$entry")"
fi
if [[ $entry == *.js ]]
then
JS="$(cat "$entry")"
fi
if [[ $entry == *.html ]]
then
HTML="$(cat "$entry")"
fi
done
echo "" > $OUT_FILE
append_line() {
echo "$1" >> $OUT_FILE
}
append_line ""
append_line "local function css()"
append_line " return [["
echo "$CSS" >> $OUT_FILE
append_line " ]]"
append_line "end"
append_line ""
append_line "local function js()"
append_line " return [["
echo "$JS" >> $OUT_FILE
append_line " ]]"
append_line "end"
append_line ""
append_line "local function html()"
append_line " return [["
echo "$HTML" >> $OUT_FILE
append_line " ]]"
append_line "end"
append_line ""
append_line "return {"
append_line " css = css,"
append_line " js = js,"
append_line " html = html,"
append_line "}"