Watcher script SCSS
This commit is contained in:
parent
7f4aee2c21
commit
ae36c5d62e
@ -1,5 +1,9 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
# This script is used to:
|
||||
# - Format SCSS, CSS, and Markdown files using `dprint`
|
||||
# - Compile SCSS to CSS using `grass`
|
||||
|
||||
set -l script_path (path resolve (status filename))
|
||||
set -l script_dir (path dirname "$script_path")
|
||||
set -l project_root (path normalize "$script_dir/../..")
|
||||
|
||||
30
fish/extra/watch_scss.fish
Executable file
30
fish/extra/watch_scss.fish
Executable file
@ -0,0 +1,30 @@
|
||||
#!/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
|
||||
Loading…
x
Reference in New Issue
Block a user