add trap to SIGTERM sass bg process
This commit is contained in:
parent
f4f8e15bf1
commit
c9dba4e240
1 changed files with 16 additions and 1 deletions
17
serve
17
serve
|
|
@ -15,6 +15,16 @@ SCSS_PATH="$WEBROOT/scss"
|
|||
CSS_PATH="$WEBROOT/css"
|
||||
# ========================= #
|
||||
|
||||
# ===== Local State ===== #
|
||||
SASS_PID=
|
||||
# ======================= #
|
||||
|
||||
function cleanup {
|
||||
if [[ -n "$SASS_PID" ]]; then
|
||||
kill "$SASS_PID"
|
||||
fi
|
||||
}
|
||||
|
||||
# Watch .sass/.scss files and compile on change
|
||||
function watch_scss {
|
||||
# watch format "SCSS_PATH:OUT_PATH"
|
||||
|
|
@ -37,8 +47,13 @@ function host {
|
|||
simple-http-server $args $@ -- "$WEBROOT"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
set -ueo pipefail
|
||||
set -x
|
||||
|
||||
# auto compile scss changes
|
||||
watch_scss &
|
||||
hostwww
|
||||
SASS_PID=$!
|
||||
|
||||
# host dev server
|
||||
host ${SRV_ARGS[@]}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue