简体   繁体   中英

ejs partials with express in sub directory

I have a page ./views/account/index.ejs that has a partial included from ./views/account/edit.ejs -- but I get an error that "path must be a string" when I call it from ./account/index.ejs

<%- partial('edit.ejs') %>

I'm using express 3.x and express-partials

If I include a partial that is at the base ./views/edit.ejs it works. How do I include a partial in a subdirectory? I tried <%- partial('account/edit') %> but it does not work.

I've got the same issue. I've fixed it inside the express-partials module and made a pull request - https://github.com/publicclass/express-partials/pull/19 .

So just install the latest module version and you are done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM