Skip to content

Instantly share code, notes, and snippets.

@val314159
Created April 18, 2014 01:56
Show Gist options
  • Save val314159/11021008 to your computer and use it in GitHub Desktop.
Save val314159/11021008 to your computer and use it in GitHub Desktop.
import os
from staching import Stache
class Stache2(Stache):
def add_template_file(s, name,prefix):
s.add_template(name, ''.join(open(prefix+name).xreadlines()))
def load_templates(s, prefix):
[ s.add_template_file(fn,prefix) for fn in os.listdir(prefix) ]
if __name__=='__main__':
from sys import argv
from json import load
s = Stache2()
s.load_templates('tmpl/')
print s.render_template(argv[1],load(open(argv[2])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment