36 lines
823 B
Fish
Executable File
36 lines
823 B
Fish
Executable File
#!/usr/bin/env fish
|
|
|
|
# Watcher script using `fswatch`.
|
|
# - Watch the `scss/` directory for changes.
|
|
# - Upon event triggers, run the format+compile script.
|
|
|
|
set -l script_path (path resolve (status filename))
|
|
set -l script_dir (path dirname "$script_path")
|
|
set -l project_root (path normalize "$script_dir/../..")
|
|
|
|
set -l scss_dir "$project_root/scss"
|
|
set -l builder "$script_dir/build_scss.fish"
|
|
|
|
if not command -q fswatch
|
|
echo "error: fswatch is not installed" >&2
|
|
exit 1
|
|
end
|
|
|
|
echo "Watching $scss_dir..."
|
|
echo "Press Ctrl-C to stop."
|
|
|
|
fswatch \
|
|
--recursive \
|
|
--event Updated \
|
|
--event Created \
|
|
--event Removed \
|
|
--event Renamed \
|
|
--latency=0.3 \
|
|
--one-per-batch \
|
|
--include '\.scss$' \
|
|
"$scss_dir" |
|
|
while read -l event
|
|
echo "SCSS change detected: $event"
|
|
"$builder"
|
|
end
|