You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So The concept here is to allow rendering part of a template, instead of the whole template, by defining a fragments system. This isnt the same as including a template in a template, and the main value is related to the use of pebble in SSR applications. Effectively, instead of passing the template you want to render, like my-template.peb, you would pass my-template.peb#fragment-name, which would only render the relevant section of a template, eg, lets say i have my-template.peb which looks like this
{ % fragment fragment-1 % }
Hi-There
{ %endfragment%}
{ % fragment fragment-2 % }
Its-a-me
{ %endfragment%}
if I chose to render my-template.peb#fragment-1, i would get
Hi-There
if i choose to render my-template.peb, i would get
So The concept here is to allow rendering part of a template, instead of the whole template, by defining a fragments system. This isnt the same as including a template in a template, and the main value is related to the use of pebble in SSR applications. Effectively, instead of passing the template you want to render, like
my-template.peb
, you would passmy-template.peb#fragment-name
, which would only render the relevant section of a template, eg, lets say i havemy-template.peb
which looks like thisif I chose to render
my-template.peb#fragment-1
, i would getif i choose to render
my-template.peb
, i would getso on and so forth
further rationale on the value of this can be found here https://htmx.org/essays/template-fragments/
More than happy to contribute this, if there is room for it. It introduces no breaking changes.
The text was updated successfully, but these errors were encountered: