dotfiles_ewwii/fish/extra/watch_scss.fish
2026-08-23 15:44:09 +05:30

31 lines
681 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 \
--latency=0.1 \
--one-per-batch \
"$scss_dir" |
while read -l event
echo "Change detected..."
"$builder"
end