Reputation: 3697
I have many files in a Folder in want to include in a Template (EJS).
I try this:
<% var test = ["foo.ejs"];
_forEach(test, function(item){ %>
<% include slides/item %>
<% }); %>
I would use Nodejs to fill the Array by looking in a folder.
But i get the error:
Error: ENOENT, no such file or directory 'app/views/slides/item.ejs'
It seems that ejs dont use "item" as a variable.
Upvotes: 1
Views: 1809
Reputation: 11
Looks like this is now supported in EJS. It was introduced in v2.0.1: 2015-01-02. The new syntax looks like this
<%- include(yourVariable) %>
Upvotes: 1
Reputation: 802
There is an issue for that problem in github. https://github.com/visionmedia/ejs/issues/93
Upvotes: 0