diff --git a/contrib/func.sh b/contrib/func.sh index 47be7ad4..6d840138 100644 --- a/contrib/func.sh +++ b/contrib/func.sh @@ -1,13 +1,14 @@ #!/usr/bin/env sh -# The github-pages function optionally takes two arguments -# - the first argument is the path to the Jekyll site -# - the second argument is the port number +# The github-pages function optionally reads two environment variables +# - the first is the path to the Jekyll site (GH_PATH) +# - the second is the port number (GH_PORT) + function github-pages { - _path=${1:-.} - _port=${2:-4000} + _path=${GH_PATH:-.} + _port=${GH_PORT:-4000} docker run --rm \ -p $_port:4000 \ -u `id -u`:`id -g` \ -v `realpath $_path`:/src/site \ - gh-pages + gh-pages jekyll serve -H 0.0.0.0 -P 4000 $@ }