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
相关问题
- MVC-Routing,Why i can not ignore defaults,The matc
- Visual Studio 2010 randomly says the command line
- (ASP.NET) Project file must include 'WindowsBa
- parameters in routing do not work MVC 3
- Partial Form Class C# - Only display code view for
相关文章
- How to show location of errors, references to memb
- Log4Net Multiple Projects
- Compiling error in C++ project with C and C++ code
- How to get a list of connected clients on SignalR
- Visual Studio Hangs on Loading UI Library
- How do you redirect to the calling page in ASP.NET
- How to use Mercurial from Visual Studio 2010?
- Change color of bars depending on value in Highcha
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.
One way to do this is using bundle transform and the jurrasic js compiler to generate a js file with all your compiled views and partial views in it.
This has the benefit of not requiring node.js or ember while still using a simple bundletransform hook.
The full source for the HandleBarBundleTransform is here.
This has the convenience of the ember solution(s) @ahmed posted for those not using ember.
Sure, you have many options: