Created
June 22, 2020 13:32
-
-
Save moaoa/d6debcb597be00d3ffd388ffea110a27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 . you need to create the views directory | |
2 . include this line of code : app.set('view engine', 'ejs'); | |
// include partials | |
<% include ../partials/head %> | |
// loop over data | |
<h2>Loop</h2> | |
<ul> | |
<% drinks.forEach(function(drink) { %> | |
<li><%= drink.name %> - <%= drink.drunkness %></li> | |
<% }); %> | |
</ul> | |
// to print variable value | |
<%= var %> | |
<% 'Scriptlet' tag, for control-flow, no output | |
<%_ ‘Whitespace Slurping’ Scriptlet tag, strips all whitespace before it | |
<%= Outputs the value into the template (HTML escaped) | |
<%- Outputs the unescaped value into the template | |
<%# Comment tag, no execution, no output | |
<%% Outputs a literal '<%' | |
%> Plain ending tag | |
-%> Trim-mode ('newline slurp') tag, trims following newline | |
_%> ‘Whitespace Slurping’ ending tag, removes all whitespace after it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment