Skip to main content
Version: 3.x.x

Syntax Cheatsheet

Conditionals

<% if (it.someval === "someothervalue") { %>
Display this!
<% } else { %>
They're not equal
<% } %>

Looping over arrays

<% users.forEach(function(user){ %>
<%= user.first %> <%= user.last %>
<% }) %>

Looping over objects

<% Object.keys(someObject).forEach(function(prop) { %>
<%= someObject[prop] %>
<% }) %>

Logging to the console

<% console.log("The value of it.num is: " + it.num) %>

Async Partials

<%~ await includeAsync("./path-to-partial") %>