I'm working on on a phonegap application. I'm using an asp.net project to do my development in and then I am compiling all my files to static html files for the phonegap app.
I want to take advantage of razor syntax for things like including files and simple logic.
Is there a way to run razor code in an html file?
I am currently using cshtml files, but PhoneGap will only accept html files. I currently have RazorEngine to compile the cshtml files to html files, but then I also need to update every link from .cshtml to .html and things are getting complicated.
Code example for razor templating...
@using System.IO;
@using RazorEngine;
@{ // render panelhtml and header html once, and then print it out below in each page
string panelHtml = Razor.Parse(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "/Views/Shared/_Panel.cshtml"));
string headerHtml = Razor.Parse(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "/Views/Shared/_HeaderLoggedIn.cshtml"));
string topHtml = Razor.Parse(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "/Views/Shared/_HeaderLoggedIn.cshtml"));
WriteLiteral(topHtml);
}
<!-- pageDebug -->
<div data-role="page" id="pageDebug" data-add-back-btn="true">
@{ WriteLiteral(panelHtml); }
@{ WriteLiteral(headerHtml); }