Skip to content

Instantly share code, notes, and snippets.

@sontek
Created December 26, 2011 23:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sontek/1522303 to your computer and use it in GitHub Desktop.
Save sontek/1522303 to your computer and use it in GitHub Desktop.
Watch less files and generate css
#!/usr/bin/env bash
while :; do
find "$PWD" -name '*.less' | while read line; do
REPLACE=`echo $line | sed "s|\.less|\.css|"`
mt1=$(stat -c %Y $line)
mt2=$(stat -c %Y $REPLACE)
if [ "$mt1" -gt "$mt2" ]; then
echo "$line --> $REPLACE"
lessc --verbose "$line" "$REPLACE"
fi
done
sleep 2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment