Skip to content

Instantly share code, notes, and snippets.

@skoppula
Created December 21, 2015 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skoppula/77b3884dc6dec345faca to your computer and use it in GitHub Desktop.
Save skoppula/77b3884dc6dec345faca to your computer and use it in GitHub Desktop.
Super simple homebrew templating script to convert HAML and SASS to a *.github.io ready static site.
#!/bin/bash
sass blog.scss blog.css
find posts/haml/ -name "*.haml" | while IFS= read -r pathname; do
haml_file="$pathname"
temp_path=${haml_file%".haml"}
html_path=${temp_path/haml/html}
echo "Compiling .haml of "${haml_file}
haml ${haml_file} ${html_path}
done
index_file="index.html.haml"
new_path=${index_file%".haml"}
echo "Compiling .haml for "${index_file}
haml ${index_file} ${new_path}
# Used for fixing the relative stylesheet link in each of the post files
# perl -pi -w -e 's/..\/blog.css/..\/..\/blog.css/g;' *.haml
# perl -pi -w -e 's/..\/index.html/..\/..\/index.html/g;' *.haml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment