summaryrefslogtreecommitdiff
path: root/docs/serve.sh
blob: b10c7649fb083fb7e667fb261fc11e2cfc2c602c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
set -e
cd "$(dirname "$0")"

if [ ! -s lab/fonts ]; then
  ln -s ../../build/dist lab/fonts
fi

if (which caddy >/dev/null); then
  caddy_args=(\
    -host localhost \
    "bind localhost" \
    "mime .woff2 font/woff2" \
    "mime .woff application/font-woff" \
  )
  caddy "${caddy_args[@]}"
elif (which servedir >/dev/null); then
  servedir
else
  echo "Can not find 'caddy' nor 'servedir' in PATH." >&2
  echo "Install caddy from brew, apt or https://caddyserver.com/download"
  echo "or install servedir with 'npm install -g secure-servedir'"
  exit 1
fi