javascript/jquery 模板建议

发布于 2024-12-15 16:08:29 字数 154 浏览 4 评论 0原文

我正在开发一个高度依赖 javascript 的大型应用程序。其中一部分将在屏幕上显示信息。我希望在 ui 上显示信息,并且正在考虑使用 javascript 模板来执行此操作。我将使用 jquery 框架。

对 javascript/jquery 模板框架有什么建议或建议吗?

I am developing a large scale application highly dependent on javascript. Part of this will be displying information on screen. I am looking to display information on the ui and I am looking at using javascript templating to do such. I will be using the jquery framework.

Any suggestions or recommendations to javascript/jquery templating frameworks?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

就像说晚安 2024-12-22 16:08:29

它不是基于 jQuery,但根据 jsperf.com 上的性能测试doT.js 模板框架始终是最快的 JS 模板框架。它没有依赖项,因此您应该能够将它与 jQuery 一起使用。

It's not jQuery based, but according to performance tests on jsperf.com, the doT.js templating framework is consistently the fastest JS templating framework. It has no dependencies, so you should be able to use it alongside jQuery.

醉生梦死 2024-12-22 16:08:29

这是一个有用的 jquery 模板库: http://icanhazjs.com/ 另外,它有一个有趣的名字!

Here is a useful library for jquery templating: http://icanhazjs.com/ Plus, it's got a fun name!

無處可尋 2024-12-22 16:08:29

仅部分同意 GregL 的观点。原始测试没有考虑最终将渲染的 html 添加到页面所花费的时间。

您还应该查看 http://jsperf.com/dom-vs-innerhtml -基于模板/259

此测试将包括将渲染的 html 文本附加到页面。

您可以将其与 http://jsperf.com/dom-vs-innerhtml 进行比较-基于模板/257

原始测试用例。您会发现模板引擎之间的差异并不那么显着。您确实需要更多地考虑模板引擎的可用性,除非您只是简单地渲染一大堆 html 文本而不将其放入客户端浏览器。

另外,在我看来,一个好的模板引擎应该可以极大地帮助你维护
模板,帮助你少写多做,这也是 jQuery 的原理。

doT.js 的性能确实很棒,但我不认为它可以帮助您高效编码。

我现在正在开发一个开源项目,尝试构建一个易于使用的模板引擎。它可以帮助您以树状结构管理模板、创建模板引用、定义自己的语法、将数据绑定到 html dom..请尝试一下

http://jspopisno1.github.com/Beard

您还可以阅读 stackoverflow 中的另一个问题

https://stackoverflow.com/questions/552934/what-javascript-模板引擎您推荐/8129492#8129492

Only agree with GregL partially. The original test does not consider the time spent to eventually append the rendered html to the page.

You should also check out http://jsperf.com/dom-vs-innerhtml-based-templating/259

This test will include appending the rendered html text to the page.

You can compare it with http://jsperf.com/dom-vs-innerhtml-based-templating/257

The original test case. You will find out that the difference across template engines is not that significant. You do need to consider more about the usability of a template engine, unless you are going to simply render a chuck of html text without put it to the client browser.

Besides, in my opinion, a good template engine should greatly help you maintain
the templates, help you write less to do more which is also the principle of jQuery.

doT.js is really great in performance, but I don't agree that it could help you code efficiently.

I am now working on an open source project to try to build a easy-to-use template engine. It can help you manage your templates in a tree-like structure, create template reference, define your own syntax, bind data to html dom.. please give it a try

http://jspopisno1.github.com/Beard

You can also have a read another question in stackoverflow

https://stackoverflow.com/questions/552934/what-javascript-templating-engine-do-you-recommend/8129492#8129492

弃爱 2024-12-22 16:08:29

是的,我已经在多个项目中使用了这个 John Resig 的 Microtemplated 引擎,并取得了巨大成功。它非常简单、可维护且易于使用。

Yes, i've used this John Resig’s Microtemplating engine with great success in several projects. It's very simple, maintainable, and easy to use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文