forked from UniverseBow/wa2k.com-Website
add nix compatible build environment
This commit is contained in:
parent
6e74e3bb32
commit
7640fd995a
7 changed files with 219 additions and 0 deletions
35
scripts/serve
Executable file
35
scripts/serve
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env bash
|
||||
# Required Binaries:
|
||||
# | simple-http-server
|
||||
# | sass
|
||||
|
||||
# ===== Configuration ===== #
|
||||
ADDR="127.0.0.1" # bind address
|
||||
PORT="8000" # bind port
|
||||
WEBROOT="www" # root web directory
|
||||
USE_INDEX=true
|
||||
NO_CACHE=true
|
||||
declare -a SRV_ARGS=()
|
||||
|
||||
function host {
|
||||
local args=( "$@" )
|
||||
# Apply Flags
|
||||
if [[ "$NO_CACHE" == true ]]; then
|
||||
args+=("--nocache")
|
||||
fi
|
||||
if [[ "$USE_INDEX" == true ]]; then
|
||||
args+=("--index")
|
||||
fi
|
||||
|
||||
# Apply Options
|
||||
args+=(--ip "$ADDR" --port "$PORT")
|
||||
|
||||
simple-http-server "${args[@]}" "$@" -- "$WEBROOT"
|
||||
}
|
||||
|
||||
# trap cleanup EXIT
|
||||
set -ueo pipefail
|
||||
set -x
|
||||
|
||||
# host dev server
|
||||
host "${SRV_ARGS[@]}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue