Open paul-mitchell-bjss opened 6 years ago
Here is the solution for rendering a dynamic list of partials with associated contexts.
input.dynamicPartials = [
'components/local-header',
'components/callout',
'components/callout'
]
input.dynamicPartialContexts = [
{ title: 'Dynamic Partials', text: 'Very useful feature' },
{ modifier: 'muted', title: 'First callout', text: 'It should be muted style' },
{ title: 'Second callout', text: 'It should be default style' }
]
{{#dynamicPartials}}
{{> (lookup ../dynamicPartials @index) (lookup ../dynamicPartialContexts @index) }}
{{/dynamicPartials}}
A recent support request has revealed that it would be helpful for the kit to contain documentation on using partials in Handlebars templates. Although the example prototypes do demonstrate simple use of partials there are more advanced uses that are not obvious, such as how to prepare and render a dynamic list of partials with associated contexts.
Documenting how to create and use partials in both simple and advanced forms will help users get the best out of the kit.