Thanks, I’ve just taken a look at ServiceStack Templates and it looks like an option.
However it looks drastically different to what I’m used to with Razor and I have very little time to learn somthing new. Is there a guide to migrate from an existing razor project to using Templates?
I’ve tried the first approach but does not seem to pick up the bundled files in wwwroot and only the bundled fiels in the dist folder as show in the pic
I’m using the following code example from the help docs
public override List<IVirtualPathProvider> GetVirtualFileSources()
{
var existingProviders = base.GetVirtualFileSources();
var memFs = new MemoryVirtualFiles();
var fs = existingProviders.First(x => x is FileSystemVirtualFiles);
foreach (var file in fs.GetAllMatchingFiles("*.js").Where(file => file.VirtualPath.EndsWith(".bundle.js")))
{
try
{
var js = file.ReadAllText();
memFs.WriteFile(file.VirtualPath, js);
}
catch (Exception ex)
{
//Report any errors in StartUpErrors collection on ?debug=requestinfo
base.OnStartupException(new Exception(
"Adding Js to Virtual File Error in {0}: {1}".Fmt(file.VirtualPath, ex.Message)));
}
}
//Give new Memory FS highest priority
existingProviders.Insert(0, memFs);
return existingProviders;
}