-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.sh
executable file
·50 lines (43 loc) · 1.15 KB
/
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
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
SELF=`echo $0 | sed 's/\\\\/\\//g'`
cd "`dirname "$SELF"`" || exit 1
set -e
DST="_site"
URL="https://fuseopen.com/docs/"
CP_FLAGS=""
GEN_FLAGS=""
FAST=0
while [ $# -gt 0 ]; do
case "$1" in
-l|--local)
shift
URL="http://localhost:8080/"
;;
-f|--fast)
shift
if [[ "$OSTYPE" = msys* ]]; then
CP_FLAGS="--update"
fi
GEN_FLAGS="--fast"
FAST=1
;;
*)
>&2 echo "Skipping unrecognized argument $1"
shift
;;
esac
done
echo -e "URL: $URL (Please wait for docs to finish building...)\n"
if [ "$BUILD" != 0 ]; then
dotnet run --project generator/src/generator.csproj -- . "$URL" "$DST" $GEN_FLAGS
fi
if [ "$ASSETS" != 0 ]; then
echo "Updating assets"
cp -r $CP_FLAGS media "$DST"/ &&
cp -r $CP_FLAGS static/* "$DST"/
if [[ "$FAST" = 0 && "$OSTYPE" != msys* ]]; then
echo "Optimizing images"
find "$DST"/media -type f \( -iname "*.png" -or -iname "*.jpg" \) -exec mogrify -strip -resize 850x850\> {} \;
find "$DST"/media -type f -iname "*.png" -exec pngquant {} \; -exec optipng -silent {} \;
fi
fi