xp-forge / handlebars-templates

Handlebars templates for XP web frontends
1 stars 0 forks source link

Implement fragments #15

Closed thekid closed 1 year ago

thekid commented 1 year ago

These can be thought of as "instantly-invoked inline partials". The following two are equivalent:

1) An inline partial (as defined by Handlebars) followed by calling it directly:

{{#*inline "items"}}
  {{#each items}}* {{.}} {{/each}}
{{/inline}}
{{> items}}

2) The fragment version we're introducing with this pull request:

{{#*fragment "items"}}
  {{#each items}}* {{.}} {{/each}}
{{/fragment}}
thekid commented 1 year ago

Released in https://github.com/xp-forge/handlebars-templates/releases/tag/v3.0.0

thekid commented 1 year ago

See also https://laravel.com/docs/10.x/blade#rendering-blade-fragments