Hashtag Helpers
With
Inject custom object context into an substitution
The with
hashtag helper allows you to inject a custom object context into a substitution. This is useful when you want to define a common object structure, then pass in a different object to be used in the substitution.
The with
hashtag helper does 2 rounds of substitution, use carefully with {{{{skip}}}}
Uses
- Use to save a dynamic image generator canvas on a base template, then use in multiple locations
Usage
Helper name : with
eg.
~~#with "~~stub.data.person"#~~template.data.canvas.team_member
Examples
Mapping person data
This example shows mapping stub.data.with_data
onto with
for purposes of substitution.
Stub Data Context
Usage Example
Result
This specific example could also be achieved with the with built-in Handlebars helper, but the with
hashtag helper allows you to pass in a different object to be used in the substitution.
Mapping person data onto an object
This example shows mapping stub.data.with_data
onto with
for purposes of substitution.
Stub & Template Data Context
Usage Example
Result
This specific example could also be achieved with the with built-in Handlebars helper, but the with
hashtag helper allows you to pass in a different object to be used in the substitution.