-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·40 lines (30 loc) · 1002 Bytes
/
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
#!/usr/bin/env bash
# Change into the project root
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
# If you created a virtual python environment, source it
if [[ -f venv/bin/activate ]]; then
echo "[*] Using virtual python environment"
source venv/bin/activate
fi
echo "[*] Installing dependencies"
python3 -m pip install -r requirements.txt
# Install the pip package
python3 -m pip install .
# delete the output dir
[[ -d public ]] && rm -rf public
# Create a fresh output dir
mkdir public
# Create a redirect to the default theme (material)
cp redirect.html public/index.html
build_with_theme() {
echo "[*] Building with theme $1"
sed "/^site_url:/s|\$|/$1/|" mkdocs.yml > "mkdocs-$1.yml"
python3 -m mkdocs build -f "mkdocs-$1.yml" -t "$1" -d public/"$1"
}
python3 -m mkdocs build -d public
if [[ -z "$1" ]]; then
echo "[*] To view the site run:"
echo python3 -m http.server --directory "'$(pwd)/public/'"
else
python3 -m http.server --directory public/ "$1"
fi