Skip to content

Instantly share code, notes, and snippets.

@bradwright
Created February 22, 2012 16:32
Show Gist options
  • Save bradwright/1885907 to your computer and use it in GitHub Desktop.
Save bradwright/1885907 to your computer and use it in GitHub Desktop.
from flask import current_app
import pystache
@template_helper
def mustache(template, **kwargs):
"""Usage:
{{ mustache('path/to/whatever.mustache', key=value, key1=value1.. keyn=valuen) }}
"""
template, _, _ = current_app.jinja_loader.get_source(current_app.jinja_env, template)
return pystache.render(template, kwargs, encoding='utf-8')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment