Created
June 9, 2013 22:29
-
-
Save tomleo/5745533 to your computer and use it in GitHub Desktop.
A quick utility script to generate HTML from haml files
This file contains 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
# This is my adhoc build script because I'm to lazy to relearn make | |
# and i'm bad at shell scripting, and sed is confusing to me | |
import os | |
import subprocess | |
OUT_PATH = os.path.realpath('.') | |
HAML_PATH = '{0}/{1}'.format(OUT_PATH, 'haml') | |
SKIP = ['.swp'] | |
def skip(f): | |
for s in SKIP: | |
if f.endswith(s): | |
return True | |
return False | |
for (path, dirs, files) in os.walk(HAML_PATH): | |
for f in files: | |
if skip(f): | |
continue | |
i = '{0}/{1}'.format(path,f) | |
o = '{0}/{1}.html'.format(OUT_PATH, f.split('.')[0]) | |
convert = subprocess.Popen( | |
['haml', '-f', 'html5', '-e', '--trace', i, o] | |
) |
This file contains 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
python htmlit.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment