-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjade-watch.sh
executable file
·51 lines (41 loc) · 1.06 KB
/
jade-watch.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
#!/bin/bash
## INFO ##
## INFO ##
INDEX=index.jade
bg_proc1='-1'
bg_proc2='-1'
counter=0
#------------------------------------------------------------------------------#
exiting()
{
counter=$((counter+1));
if [ $counter -ge 2 ];
then
printf "\nExited background process: ${bg_proc1}\n";
printf "Exited background process: ${bg_proc2}\n";
fi;
}
#------------------------------------------------------------------------------#
keyboard_interrupt()
{
if [ $bg_proc1 -ne -1 ];
then
kill $bg_proc1;
fi;
if [ $bg_proc2 -ne -1 ];
then
kill $bg_proc2;
fi;
exiting;
}
#------------------------------------------------------------------------------#
trap keyboard_interrupt SIGINT SIGTERM EXIT;
printf "Start watching ${INDEX} for changes:";
jade -O '{"MINIFIED": true}' --watch $INDEX &
bg_proc1=$!
printf "\nMinified compiling process forked in background: ${bg_proc1}\n"
jade -P -E test.html --watch $INDEX &
bg_proc2=$!
printf "Test version compiling process forked in background: ${bg_proc2}\n"
wait;
exit;