JacksonTian / ejs-mate

Express 4.x layout, partial template functions for the EJS template engine.
205 stars 36 forks source link

partial can't use the path which in express sets #27

Open Nicolaschinc opened 7 years ago

Nicolaschinc commented 7 years ago

Like that:

/app.js/

var app = express();
var express = require('express');
var ejsMate = require('ejs-mate');
var path = require('path');

app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.engine('ejs',ejsMate);

we set the static path at views

catalogue:

|---views | |---src | | |---list.ejs | | |---main.ejs | |---layout | | |---layout.ejs /main.ejs*/

<% layout('/layout/layout') %>
<%- partial('/src/list',{name:"abc"}) %>

layout true but partial is wrong which consoles that could not find the path

why?