Template Syntax

This page is still a work in progress and may not yet be fully complete.

Setting attributes

Add set: in front of the attribute to make it a computed attribute.

<a set:href="importedValue">
<img set:src="url" set:alt="altTextPassedIn">

Using JavaScript expressions

You can use basic Javascript expressions within components.

Math Evaluation

Note that <!-- my-first-component --> and <!-- my-email --> are comments that denote which file is being used. They are not necessary for functionality and can be removed.

<!-- my-first-component -->
<component>
<div>${4*50}</div>
</component>

Use this component in an email:

<!-- my-email -->
<html>
<body>
A simple email
<my-first-component>
</body>
</html>

the output is:

<!-- my-email -->
<html>
<body>
A simple email
<div>
200
</div>
</body>
</html>

String Manipulations

<!-- my-first-component -->
<component>
<div>${'some text'.toUpperCase()}</div>
</component>

the output is:

<!-- my-email -->
<html>
<head></head>
<body>
A simple email
<div>
SOME TEXT
</div>
</body>
</html>

JSON Stringify

<!-- my-first-component -->
<component>
<div>
${JSON.stringify({
"firstName":"Adam",
"lastName": "Bluebeard"})}
</div>
</component>

the output is:

<!-- my-email -->
<html>
<head></head>
<body>
<div>
{"firstName":"Adam","lastName":"Bluebeard"}
</div></body>
</html>

Allowed functions

Debugging data