Search code examples
.netvisual-studioasp.net-mvc-4hamlnhaml

How to use NHaml in MVC 4?


I have used haml in Ruby on Rails, and I found a haml version in .Net called NHaml, I am tired to search how to implement NHaml in a web application, I read this article: http://weblogs.asp.net/stephenwalther/asp-net-mvc-tip-35-use-the-nhaml-view-engine but I can't complete the steps because I have an error with this line

ControllerBuilder.Current.SetControllerFactory(new NHamlControllerFactory());

I think that the tutorial is for a old version, I need to use Html in MVC 4, really I don't know if the project is dead, because the information that I found is of 2011, 2010, 2009...


Solution

  • Remove any old versions you have and install this one:

    https://github.com/NHaml/NHaml

    Then, add this line:

    ViewEngines.Engines.Add(new NHaml.Web.Mvc3.NHamlMvcViewEngine())