Template Guides

Using EJS

EJS is the templating language used by Cakedesk. EJS stands for "Embedded Javascript" and it allows you to run JavaScript code inside your HTML templates.

On this page you'll find some common EJS snippets that you can use in your template.

If the variable is a string and contains any HTML tags, those HTML tags will show up as plain text.

<%= proposal.title %>

If the variable is a string and contains HTML tags, those HTML tags will get interpreted as HTML.

<%- item.description %>

#If

<% if (invoice.seller.vatId) { %>
	<p>VAT ID: <%= invoice.seller.vatId %></p>
<% } %>

#If - Else

<% if (invoice.seller.vatId) { %>
	<p>VAT ID: <%= invoice.seller.vatId %></p>
<% } else { %>
	<p>The client has no VAT ID.</p>
<% } %>

#Loop Over an Array

<ul>
	<% invoice.items.forEach((item) => { %>
		<li><%= item.title %></li>
	<% }) %>
</ul>