Node.js - EJS - including a partial

Works with Express 4.x :

The Correct way to include partials in the template according to this you should use:

<%- include('partials/youFileName.ejs') %>.

You are using:

<% include partials/yourFileName.ejs %>

which is deprecated.


With Express 3.0:

<%- include myview.ejs %>

the path is relative from the caller who includes the file, not from the views directory set with app.set("views", "path/to/views").

EJS v1 includes
EJS v2 includes

(Update: the newest syntax for ejs v3.0.1 is <%- include('myview.ejs') %>)

Tags:

Node.Js

Ejs