tera
tera copied to clipboard
Is it possible to render 1 specific block in a template?
Hi, thanks for writing+maintaining Tera; it's great!
Given a template like this:
{{ foo }}
{% block bar_block %}
{{ bar }}
{% endblock %}
Is it possible to render just the bar_block block using Tera? From skimming the API docs I don't think it is, but maybe I'm missing something.
The use case I have is an HTMX UI, where it's useful to be able to render parts of a template. Prior art: the jinja2-fragments library, the render_block function in Minijinja.
Not currently but this is something I'm thinking of adding for v2, I'm working on block support for it and will likely do a render_block fn anyway internally so it shouldn't be too hard to expose