xam*_*mir 12 javascript asp.net-mvc mono css3 bundling-and-minification
背景:我在迁移的ASP.NET
MVC 5
应用程序(在开发Windows 8.1, VS2013
社区.NET 4.5.1
,MySql
自定义成员资格和角色提供)项目Monodevelop
(在Ubuntu 14.4
,Monodevelop
,Mono
).
在我的~/App_Start/BundleConfig
班上
public static void RegisterBundles(BundleCollection bundles)
{
BundleTable.EnableOptimizations = true;
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
}
Run Code Online (Sandbox Code Playgroud)
在我~/Views/Shared/_Layout.cshtml
看来
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
Run Code Online (Sandbox Code Playgroud)
在我的 Web.Config
<add namespace="System.Web.Optimization" />
Run Code Online (Sandbox Code Playgroud)
也
<compilation defaultLanguage="C#" debug="false"> </compilation>
Run Code Online (Sandbox Code Playgroud)
也Microsoft.Web.Infrastructure.dll
从bin目录中删除.
问题:当我在浏览器中查看源代码时,我没有看到正在渲染包:
链接指向目录,它应该显示目录中的文件
<link href="/Content/css" rel="stylesheet"/>
<script src="/bundles/modernizr"></script>
Run Code Online (Sandbox Code Playgroud)
我在这做错了什么?
在BundleConfig文件中添加以下内容:
BundleTable.EnableOptimizations = true;
Run Code Online (Sandbox Code Playgroud)
然后切换到释放模式.
这应该可以解决问题