I was wondering if there was a general consensus on the "best" alternative view engine for asp.net MVC. So far I know of Spark, Brail, NHaml but what about others?
I would suggest that you take each of the above View Engines, write a view, and see which works best for you. You might find that for different applications or even for differnt types of view that the choice of View Engine changes.
If you're returning HTML to your client then an engine like Spark might be appropriate. However, if the conent you're returning is XML or some other markup (JSON for example) then Spark won't be much help. NHaml is also focused on XHTML generation.
Consider how you want to test your views, the skill set of your engineers (both developers and testers), the level of support you're hoping to get from your View Engine writer (if you find bugs, how you want those bug fixes deployed) and whether your customer has any preference.
Basically - try a few, see what you like, use a mixture of them if you find that makes sense.
Oh, and here's a good post that lists 4 alternative engines...
... it mentions an XSLT engine that might be appropriate if you're looking to generate XML.
In software, there are no "best" alternative. It always depends in your background, the company you work for, your preferences, your tastes, etc.
Just pick what work best for you for the current project. If you are not sure, pick the safe way, the MS way :)
StringTemplate is a decent alternative.
Here's the ViewEngine (with Source), and some tutorials.
When making you're decision also make sure you consider the skill level and experience within the team.
If you have developers new to mvc then they are going to find a lot more book, examples and solutions if they are using the default engine. Doesn't mean its the "best" or most productive but might provide the quickest ramp-up time for new developers.
来源:https://stackoverflow.com/questions/649768/alternative-asp-net-mvc-view-engines