django-jstemplate icon indicating copy to clipboard operation
django-jstemplate copied to clipboard

Add support for TwigJS

Open stevelacey opened this issue 11 years ago • 2 comments
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.

stevelacey avatar Jul 18 '14 12:07 stevelacey

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 avatar Jul 18 '14 12:07 stevelacey

@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.

mjumbewu avatar Jul 24 '14 21:07 mjumbewu