django-jstemplate
django-jstemplate copied to clipboard
Add support for TwigJS
trafficstars
I am just using doing this for now and parsing the template manually:
<script type="text/x-twig-template" id="example-template">
{% rawjstemplate 'example-template' %}
</script>
But, formal support for Twig.js would be cool.
As an added bonus, being able to name the file example-template.html.twig would be more self-descriptive and consistent with other implementations.
@stevelacey you can control the extension that django-jstemplate looks for with the JSTEMPLATE_EXTS setting variable (e.g., JSTEMPLATE_EXTS = ['html.twig']).
For the formal support, I would gladly accept a pull request :wink:. If your above example is what it takes, it shouldn't be difficult. Check out the mustachejs template tag for an example.