Skip to content

Instantly share code, notes, and snippets.

@Yardboy
Created August 11, 2010 00:46
Show Gist options
  • Save Yardboy/518297 to your computer and use it in GitHub Desktop.
Save Yardboy/518297 to your computer and use it in GitHub Desktop.
#!/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