Node.js express: confuse about ejs template

后端 未结 2 1967
日久生厌
日久生厌 2021-01-14 15:17

I put my ejs template file in views folder like:

views
|
|--foo.html
|
|--layout.html

so I config my ejs template

相关标签:
2条回答
  • 2021-01-14 15:50

    Try to use ejs-locals then you can do this in a login.ejs file:

    <% layout('layout') -%>
    <form></form>
    
    0 讨论(0)
  • 2021-01-14 16:11

    Ahah you just got tricked by Express 3 change in layout management. The official example: https://github.com/visionmedia/express/tree/master/examples/ejs Has not been updated.

    In Jade you now have to use blocks and extend the layout. http://www.devthought.com/code/use-jade-blocks-not-layouts/

    0 讨论(0)
提交回复
热议问题