Has anyone had any luck using System.Web.Optimization with Nancy Self Hosting? If I comment out "Styles.Render("~/csspack/logincss").ToString()" the view works fine. If I leave it in a blank page is sent to the browser.
This is what my Razor config looks like.
public class RazorConfig : IRazorConfiguration
{
public IEnumerable<string> GetAssemblyNames()
{
yield return "Microsoft.Web.Infrastructure";
yield return "WebGrease";
yield return "System.Web.Optimization";
yield return "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
}
public IEnumerable<string> GetDefaultNamespaces()
{
yield return "Microsoft.Web.Infrastructure";
yield return "WebGrease";
yield return "System";
yield return "System.Web";
yield return "System.Web.Optimization";
yield return "Nancy.ViewEngines.Razor";
}
public bool AutoIncludeModelNamespace
{
get { return false; }
}
}
I registered it in startup like this.
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{
container.Register<IRazorConfiguration, RazorConfig>().AsSingleton();
container.Register<RazorViewEngine>();
.....bundle code...
}
This is my view.
inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic>
@using Nancy.Helpers
@using System.Web.Optimization
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="utf-8" />
<title>Log In</title>
@Html.Raw(Styles.Render("~/csspack/logincss").ToString())
</head>
.... more html ....