Created
August 11, 2010 00:46
-
-
Save Yardboy/518297 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Based on terrbear's "html2haml an entire directory" at http://terrbear.org/?p=277 | |
# This script needs to be executable and located somewhere in your PATH | |
CMD=`basename $0` | |
if [ -z "$1" ]; then | |
wdir="." | |
else | |
wdir=$1 | |
fi | |
function hamlify { | |
for f in $( ls $wdir/*.erb ); do | |
out="${f%.erb}.haml" | |
if [ -e $out ]; then | |
echo "skipping $out; already exists" | |
else | |
echo "hamlifying $f" | |
html2haml $f > $out | |
fi | |
done | |
} | |
for d in $( find $wdir -maxdepth 1 -mindepth 1 -type d ); do | |
echo "in directory $d:" | |
$CMD $d | |
done | |
hamlify |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment