本文介绍了支持布局和局部的节点快速模板引擎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种做模板的好方法(允许我写html而不是翡翠),可以支持布局和局部视图?

Is there a good way of doing templating (that allows me to write html -- not jade), that will support layouts and partials?

我只能将ejs与express-partials npm插件一起使用来获得此行为.但是我觉得ejs网站已经过时,并且没有得到很好的支持.

I have only been able to use ejs with express-partials npm plugin to get this behavior. However I feel the ejs site is out of date and not well supported.

我正在寻找好的例子.

我想创建一个包含页眉+页脚的主布局,并为导航添加一个单独的模板.

I want to create a main layout that would have header + footer and include a separate template for the nav for example.

Knockoutjs看起来受到很好的支持,但是我找不到许多将它与express一起使用的示例.

Knockoutjs looks well supported, but I cannot find many examples of using it with express.

更新:我在LinkedIn的js模板评估中找到了一篇不错的文章: http://engineering.linkedin.com/frontend/client-side-templating-throwdown-mustache-handlebars-dustjs-and-more

Update: I found a pretty good article here from LinkedIn's evaluation of js templates: http://engineering.linkedin.com/frontend/client-side-templating-throwdown-mustache-handlebars-dustjs-and-more

推荐答案

我已经决定将visionmedia的ejs与ejs-locals一起用于布局,包含和块.

I have settled on using visionmedia's ejs with ejs-locals for layouts, includes, and blocks.

https://github.com/RandomEtc/ejs-locals https://github.com/visionmedia/ejs

https://github.com/RandomEtc/ejs-localshttps://github.com/visionmedia/ejs

这篇关于支持布局和局部的节点快速模板引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 02:46