mozilla/nunjucks

template-fragments

johntom opened this issue · 6 comments

Hi,
I've been using htmx and they have a section in docs called https://htmx.org/essays/template-fragments/. I then found out that fragments are supported in Apostroph 3 (https://v3.docs.apostrophecms.org/guide/fragments.html#using-fragments) which uses numjucks as its template engine and I'm curious if ...

  1. Are they using fragments in the same way as jinja2?
  2. Do you plan to support template-fragments in a future release?
    Very happy user using fastify/nunjucks and htmx.
    TIA
    John

hey, can I work on this issue

I think this should not be in core. It is a requirement specific to the usage of a third-party software implementing server-driven partial hydration of front-end views, a concern that is not in scope of the Nunjucks templating library. For all other flows and purposes, asynchronous data should be loaded prior to a synchronous Nunjucks render call, or should use an asynchronous custom loader together with an async Nunjucks render call