Skip to content

Instantly share code, notes, and snippets.

@malthe
Created September 22, 2011 08:14
Show Gist options
  • Save malthe/1234308 to your computer and use it in GitHub Desktop.
Save malthe/1234308 to your computer and use it in GitHub Desktop.
less.app in bash
#!/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);
@reedobrien
Copy link

awesome

@seletz
Copy link

seletz commented Sep 22, 2011

cool.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment