Skip to content

Commit

Permalink
Added list example
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Dec 5, 2010
1 parent b1d822e commit c765c71
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/list.ejs
@@ -0,0 +1,7 @@
<% if (names.length) { %>
<ul>
<% names.forEach(function(name){ %>
<li><%= name %></li>
<% }) %>
</ul>
<% } %>
16 changes: 16 additions & 0 deletions examples/list.js
@@ -0,0 +1,16 @@

/**
* Module dependencies.
*/

var ejs = require('../')
, fs = require('fs')
, str = fs.readFileSync(__dirname + '/list.ejs', 'utf8');

var ret = ejs.render(str, {
locals: {
names: ['foo', 'bar', 'baz']
}
});

console.log(ret);

0 comments on commit c765c71

Please sign in to comment.