rename host -> serve + serve now watches for scss changes
This commit is contained in:
parent
f11ab29328
commit
ba6a4de70c
2 changed files with 44 additions and 18 deletions
18
host
18
host
|
|
@ -1,18 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# ===== Configuration ===== #
|
||||
NOCACHE=true
|
||||
SRV_ARGS=""
|
||||
# ========================= #
|
||||
|
||||
function hostwww (
|
||||
local ARGS="$SRV_ARGS"
|
||||
if [[ "$NOCACHE" == true ]]; then
|
||||
ARGS+=" --nocache"
|
||||
fi
|
||||
|
||||
cd www
|
||||
simple-http-server $ARGS $@
|
||||
)
|
||||
|
||||
hostwww
|
||||
44
serve
Executable file
44
serve
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env bash
|
||||
# Required Binaries:
|
||||
# | simple-http-server
|
||||
# | sass
|
||||
|
||||
# ===== Configuration ===== #
|
||||
ADDR="127.0.01" # bind address
|
||||
PORT="8000" # bind port
|
||||
WEBROOT="www" # root web directory
|
||||
USE_INDEX=true
|
||||
NO_CACHE=true
|
||||
SRV_ARGS=""
|
||||
|
||||
SCSS_PATH="$WEBROOT/scss"
|
||||
CSS_PATH="$WEBROOT/css"
|
||||
# ========================= #
|
||||
|
||||
# Watch .sass/.scss files and compile on change
|
||||
function watch_scss {
|
||||
# watch format "SCSS_PATH:OUT_PATH"
|
||||
sass --watch "$SCSS_PATH:$CSS_PATH"
|
||||
}
|
||||
|
||||
function host (
|
||||
local args="$SRV_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"
|
||||
)
|
||||
|
||||
set -ueo pipefail
|
||||
set -x
|
||||
|
||||
watch_scss &
|
||||
hostwww
|
||||
Loading…
Add table
Add a link
Reference in a new issue