About the front-end template engine?

template engine can greatly simplify the rendering of front-end data, so who is better in terms of performance than the template engine or the native string stitching through loops? Are there any good lightweight template engines available?


template engine parsing is the same as string concatenation. If dynamic parsing performance is weaker, mustache is lighter


.

in principle, template engines need to support more complex syntax, and the processing speed will be a little slower; but some template engines have a technology similar to compilation, which converts the template parsing results into javascript code, and the performance gap should be very small compared with the direct spelling string.

so if it weren't for a scenario with thousands of lines on the page, the performance of the template engine wouldn't be too concerned at all.
I feel more convenient to use artTemplate, before, and I have a lot of information on the Internet, so I can do a performance test and comparison by myself.


so who is better in terms of performance than a template engine or a native string concatenation through a loop?

the same.

are there any good lightweight template engines currently available?

nunjucks https://mozilla.github.io/nun.

in addition, there is almost no need to introduce templates for, Angular, React,.


using a template engine is of course slower, but the gap is small, which is nothing compared to the benefits it brings.

very easy pages do not need to use templates, but a large amount of code will be used, it will greatly liberate your labor force, and later maintenance and expansion will be better.

used templates are pug,artTemplate,ejs.

if it is a long-term use, it is recommended that the pug, business logic be clear.


the way the front-end framework renders data is similar to the previous template engine. You don't have to introduce it anymore. If you use pug,ejs, for the back-end node, use pug,ejs,. A lot of engines used a few years ago, and now these front-end frameworks basically don't use vue's {{}}, which is the syntax of mustache



art. -template document


art-template bar, The only template engine I have used at this stage is quite easy to use, mainly because it is not difficult to understand


if you want to be lightweight, gulp-fileinclude doesn't know how to count. I'm currently using it. Although I'm very lightweight, I don't like his grammar very much. I'm going to change it to something else. I don't feel the degree of withdrawal is high enough

. < hr >

hitchhiking, I have currently built an automated front-end environment with gulp, and its main project types are static pages, so the template wants to precompile gulp, and the final files are complete ordinary static HTML,. Under this requirement, what template engine is more suitable. The main things I want are circular rendering, on-demand rendering, populating data, include, and preferably a formatting plug-in under VSCODE

Thank you

Menu