-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.sh
executable file
·94 lines (69 loc) · 1.32 KB
/
dev.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
#!/bin/bash
# dev.sh
function usage() {
echo "
To development:
./dev.sh
To watch jade:
./dev.sh --watch-jade
To watch stylus:
./dev.sh --watch-stylus
To run livereload:
./dev.sh --livereload
To run a server:
./dev.sh --server
"
}
# Empty arguments
if [[ -z "$1" ]]; then
usage;
exit 1;
fi
# Parse arguments
while [[ $# > 0 ]]; do
key="$1"
case $key in
--watch-jade)
__watch_jade=true
;;
--watch-stylus)
__watch_stylus=true
;;
--server)
__server=true
;;
--livereload)
__livereload=true
;;
-h|--help)
usage;
exit 1;
;;
*)
usage;
echo " [error] unknown option:" $key;
exit 1;
;;
esac
shift;
done
# Watch Jade
if [[ $__watch_jade ]]; then
echo " watch jade"
jade --watch --pretty --out ./new-module/ ./new-module-src/*.jade
fi
# Watch Stylus
if [[ $__watch_stylus ]]; then
echo " watch stylus"
stylus --watch --out ./new-module ./new-module-src/*.styl
fi
# Livereload
if [[ $__livereload ]]; then
echo " run livereload"
livereload .
fi
# Server
if [[ $__server ]]; then
echo " run server"
http-server .
fi