简体   繁体   English

没有后端的模板引擎?

[英]Templating engine without a backend?

I'm building a very simple, entirely front end app for a class and I need a JS templating engine. 我正在为一个类构建一个非常简单的完全前端应用程序,并且需要一个JS模板引擎。 I want to generate HTML elements from a JSON file, and I want to use partials from separate files. 我想从JSON文件生成HTML元素,并且我想使用来自单独文件的局部文件。 Ideally I'd prefer to use vanilla JS and no jQuery. 理想情况下,我更喜欢使用香草JS,而不要使用jQuery。

I've been looking into Mustache, Handlebars, EJS and several others, but the options are overwhelming and I just want something simple. 我一直在研究Moustache,Handlebars,EJS和其他几种,但是选择非常多,我只想简单一些。

What would you recommend? 你会推荐什么?

I would suggest taking a look at https://engineering.linkedin.com/frontend/client-side-templating-throwdown-mustache-handlebars-dustjs-and-more 我建议您看一下https://engineering.linkedin.com/frontend/client-side-templating-throwdown-mustache-handlebars-dustjs-and-more

Go straight the "The four finalists section" where you can find pros and cons for each. 直接进入“四个决赛入围者”部分,您可以在此找到各自的优缺点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM