ejs layout

express 3.x 中使用ejs的模版比较麻烦一点,但是还是很容易的。
已经不支持layout功能了,用include实现,更强大了。

Currently EJS has no notion of blocks, only compile-time includes, however you may still utilize this feature to implement "layouts" by simply including a header and footer like so:

<% include head %>
<h1>Title</h1>
<p>My page</p>
<% include foot %>

  

 

原文地址:https://www.cnblogs.com/wssdzf/p/3328333.html