Handlebars
Handlebars is a JavaScript library used for creating dynamic templates.
It allows you to define templates with placeholders, and these placeholders are replaced with data when the template is triggered with the information sent in the payload.
Handlebars within Fyno support features like conditional operations, loops, date time formatting, partial searches, and custom helpers, making it a very cool tool to use when creating your templates.
Handlebars in Fyno’s Templates
To understand how handlebars work, we first need to establish a sample payload, based off which the Handlebars function and applicability can be demonstrated.
Fyno has default as well as custom handlebars that you can use in your templates. Let’s have a look at what these are and how to use them using the above payload and data as example responses.
🚧 Double Quotes within Handlebars {{" "}} may break your templates!
Double quote may break your syntax in HBS, especially in emails! And nobody wants that!
For example: Use {{math number1 '+' number2}}
instead of {{math number1 "+" number2}}
.
Use single quotes {{' '}}
instead! 😎