This article似乎暗示存在诸如 include
模板之类的东西。我进行了明显的 Google 搜索,但没有找到任何文档。
它们是什么?
最佳答案
来自Express guide :
The Express view system has built-in support for partials and collections, which are “mini” views representing a document fragment. For example rather than iterating in a view to display comments, we could use partial collection.
因此,当您在多个页面中为用户提供相同的“ View ”时,将该 View 存储在一个文件中并将其“包含”在任何地方会更有用。 (干 - 不要重复自己)
另一个例子是当到处都有相同的布局并且你想包括页面的其余部分时(例如,你可以根据页面包括不同的页眉、页脚和正文)。
这是一个很好的 Jade 示例,在 Express 示例中提供:
https://github.com/visionmedia/express/tree/master/examples/jade/views
关于node.js - Express/Jade 中的 "include template"是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8461429/