I'm evaluating template engines for email to run on the JVM (Kotlin or Java), I've looked at FreeMarker, Velocity and Mustache so far, any other ones that are worth looking at ?
FreeMarker
Has everything I need, syntax looks strange.
if-else:
<#if condition>
... 1
<#elseif condition2>
... 2
<#elseif condition3>
... 3
<#else>
... 4
</#if>
or
[#if condition]
... 1
[#elseif condition2]
... 2
[#elseif condition3]
... 3
[#else]
... 4
[/#if]
loop:
<#list 1..x as i>
${i}
</#list>
or
[#list 1..x as i]
${i}
[/#list]
value:
${value}
Mustache
Lacking decent if-else syntax, not sure if it can do loops, value syntax looks nice.
if-else
{{#condition}}
... 1
{{/condition}}
{{^condition}}
{{#condition2}}
... 2
{{/condition2}}
{{^condition2}}
{{#condition3}}
... 3
{{/condition3}}
{{^condition3}}
... 4
{{/condition3}}
{{/condition2}}
{{/condition}}
loop:
How do I loop in mustache templates ???
value:
{{value}}
Velocity
#if ($condition)
... 1
#elseif ($condition2)
... 2
#elseif ($condition3)
... 3
#else
... 4
#end
loop:
#foreach($i in $range)
$i
#end
value:
$value
Any other worthwhile template engines to look at ?
Shreyansh Pandey
node, coffee and everything in between
Try using HandleBars.
It's a better alternative to Mustache; mainly because: