-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·133 lines (97 loc) · 2.2 KB
/
build.sh
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
# build.sh
function usage() {
echo "
To build jade:
./build.sh --jade
To build jade with compress:
./build.sh --jade --jade-compress
To build stylus:
./build.sh --stylus
To build stylus with compress:
./build.sh --stylus --stylus-compress
To build script:
./build.sh --script
To build script with compress:
./build.sh --script --script-compress
To build script with sourcemap:
./build.sh --script --script-sourcemap
To build all:
./build.sh --all
To build all with compress:
./build.sh --all --all-compress
"
}
# Empty arguments
if [[ -z "$1" ]]; then
usage;
exit 1;
fi
# Parse arguments
while [[ $# > 0 ]]; do
key="$1"
case $key in
--jade)
__jade=true
;;
--jade-compress)
__jade_compress=true
;;
--stylus)
__stylus=true
;;
--stylus-compress)
__stylus_compress=true
;;
--script)
__script=true
;;
--script-compress)
__script_compress=true
;;
--script-sourcemap)
__script_sourcemap=true
;;
--all)
__all=true
;;
-h|--help)
usage;
exit 1;
;;
*)
usage;
echo " [error] unknown option:" $key;
exit 1;
;;
esac
shift;
done
# Build jade
if [[ $__jade ]]; then
echo " build jade"
jade --out ./new-module/ ./new-module-src/*.jade
fi
# Build stylus
if [[ $__stylus ]]; then
echo " build stylus"
stylus --compress --out ./new-module/ ./new-module-src/*.styl
fi
# Build script
if [[ $__script ]]; then
echo " build script"
# Compress script
if [[ $__script_compress ]]; then
echo " build script with compress"
fi
# Create sourcemap of script
if [[ $__script_sourcemap ]]; then
echo " build script with sourcemap"
fi
fi
# Build all
if [[ $__all ]]; then
./build.sh --jade --jade-compress
./build.sh --stylus --stylus-compress
./build.sh --script --script-compress --script-sourcemap
fi