public
Last active

less.app in bash

  • Download Gist
less.app
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/bin/bash
 
if [ ! -d $1 ]; then
echo "Not a directory: $1"
exit -1
fi
 
while read line; do
filename="$(basename $line)"
if [ "${filename##*.}" == "less" ]; then
path="$(dirname $line)"
lessc -x "${line}" > \
"${path}/../css/`echo ${filename} | cut -f1 -d. -`.css";
fi;
done < <(inotifywait -r -q -m -e MODIFY --format '%w%f' $1);

cool.

Note that instead of the mostly unreadable backticks, you can use $() when using bash.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.