-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path_watchStart
More file actions
executable file
·54 lines (32 loc) · 1.03 KB
/
_watchStart
File metadata and controls
executable file
·54 lines (32 loc) · 1.03 KB
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
#!/bin/sh
RELOAD="../node_modules/reload/bin/reload"
JEKYLL="/usr/local/bin/jekyll"
# check to make sure tools are available
if [ ! -f "${RELOAD}" ]; then
echo "You need to install reload."
echo "For more info see: https://www.npmjs.com/package/reload"
echo ">>>> % npm -g reload"
exit 1
fi
# check to make sure tools are available
if [ ! -f "${JEKYLL}" ]; then
echo "You need to install Jekyll."
echo "For more info see: http://jekyllrb.com"
echo ">>>> % gem install jekyll"
exit 1
fi
# Brute force make sure jekyll
# and reload are not already running
killall ruby 2>/dev/null
killall node 2>/dev/null
# start up jekyll as a server
# set the config to the local config
${JEKYLL} serve --config _config-local.yml &
JEKYLLPID=`echo $!`
echo "Found PID: '${JEKYLLPID}'"
# set up trap so we can shut down cleanly
trap "kill -9 ${JEKYLLPID}; exit 0" SIGHUP SIGINT SIGTERM
#after a couple seconds, start the browser
bash -c 'sleep 3; open "http://localhost:8080"' &
# now start live reload on the generated site
${RELOAD} --dir _site