forked from sfz/sfz.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·42 lines (34 loc) · 1.01 KB
/
setup.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
#!/bin/bash
cd $PWD
set -e
script_name=$(basename $0 | sed "s/\.sh$//")
if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
echo "Setup and run Jekyll"
echo ""
echo "Usage: ${script_name} [option]"
echo ""
echo "Options are not mandatory, only one at a time."
echo "-a, --assets Build minimized css style and js script from sources."
echo "-i, --install Install Bundler and node modules using Yarn."
echo "-n, --normal Runs Jekyll in normal, non incremental mode."
echo ""
exit 0
fi
# Install or update ruby and yarn packages
if [ ! -d "node_modules" ] || [ "$1" == "-i" ] || [ "$1" == "--install" ]; then
gem update
gem install bundler
bundle install
yarn --no-bin-links
fi
# Rebuild minimized assets
if [ ! -f "assets/css/style.min.css" ] || [ "$1" == "-a" ] || [ "$1" == "--assets" ]; then
yarn dist
fi
# Enable Jekyll incremental build by default
if [ "$1" == "-n" ] || [ "$1" == "--normal" ]; then
incremental=
else
incremental="-I"
fi
bundle exec jekyll serve --watch --host=0.0.0.0 $incremental