10

I'm trying to find an HTML templating solution that will work both on my ASP.NET MVC application (.NET 4, IIS 7.5) and in the browser. The reason is to the the same code to render HTML both on the server (performance, outputting to mobile, etc) or on the browser (refreshing data via AJAX). This is not a new problem, but I am wondering if current technology trends have changed the answer.

A couple of ideas I am considering:

ASP.NET MVC View Engine Comparison looked relavent, but there is no mention of mustache.

Update: The client-side templating throwdown: mustache, handlebars, dust.js, and more from LinkedIn Engineering rates mustache in it's top four, with it being the only one with native .NET rendering (vs requiring server-side JavaScript to render on the server).

2 Answers 2

5

I would highly recommend mustache for your application. You have already mentioned abt the fact that it has a server side rendering engine and also a strong community backing. Apart from this the major reason why I would recommend mustache is for Performance of the templating engine. I have played around with the same and none of the other JS templating solution could match the performance of mustache.

What I would like more is documentation around the library but you should be able to work around this.

Sign up to request clarification or add additional context in comments.

Comments

1

I have done that using Spark view engine, it is quite good with the template where you can use it from .net and js.

2 Comments

Can you render Spark templates in the browser? I thought the view engine just worked in the .NET runtime.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.