I'm specifically trying to simultaneously watch 2 different filetypes in 2 subdirectories:
.coffee filetypes in the 'js' subdirectory
.styl filetypes in the 'css' subdirectory
I only know so much bash and I'm trying to get something like this to function
while inotifywait --format %w%f ./{css,js}/*.{styl,coffee}; do
# regex pattern to match the file ending
# and define it to $ending
if[ $ending == coffee ]
then
coffee -c $file
elif[ $ending == styl ]
then
stylus -c $file
fi
done
// Edit //
modified this line:
while inotifywait --format %w%f ./{css,js}/*.{styl,coffee}; do
So now it checks both files but if there's no .coffee files on the css folder, or .styl files in js, it returns an error that no files were found.
Additionally I noticed when I run this script, it returns/runs the following 3 times
Setting up watches.
Watches established.
./css/styles.styl
Not the cleanest solution but works
If you have a better solution that only watches the files I want, then I'm all ears