How can I precompile HandlebarsJS templates from Visual Studio?

后端 未结 3 1747
悲哀的现实
悲哀的现实 2021-02-03 12:57

Is it possible to precompile Handlebars Templates from a postbuild event of Visual Studio or in the App_Start of a MVC web app? Thanks so much in advance. Dale

3条回答
  •  隐瞒了意图╮
    2021-02-03 13:44

    I know this question was on Visual Studio 2010 but I found it when looking for a solution to Handlebars recompile in VS2013. I spent some time looking at solutions until I found that Web Essentials for Visual Studio added auto-precompile of handlebars templates in November 2014.

    This feature in Web Essentials is not very well publicised and I only found it when I was building my solution and found that a .hbs.js file automatically appeared when I edited a handlebar .hbs file! I wasted a lot of time looking for solutions when it was already there.

    I hope this answer helps someone else.

提交回复
热议问题