我的 web.config(s)debug="true"都有,我只是不希望我的包被缩小,但我做的任何事情似乎都没有禁用它。我试过了,这是我的代码: __enableoptimisations=false
debug="true"
enableoptimisations=false
//Javascript bundles.Add(new ScriptBundle("~/bundles/MainJS") .Include("~/Scripts/regular/lib/mvc/jquery.validate.unobtrusive.js*") .Include("~/Scripts/regular/lib/mvc/jquery.validate*") .Include("~/Scripts/regular/lib/bootstrap.js") .IncludeDirectory("~/Scripts/regular/modules", "*.js", true) .IncludeDirectory("~/Scripts/regular/pages", "*.js", true) .IncludeDirectory("~/Scripts/regular/misc", "*.js", true)); //CSS bundles.Add(new StyleBundle("~/bundles/MainCSS") .Include("~/Content/css/regular/lib/bootstrap.css*") .IncludeDirectory("~/Content/css/regular/modules", "*.css", true) .IncludeDirectory("~/Content/css/regular/pages", "*.css", true))
如果您debug="true"在 web.config 中使用并Scripts/Styles.Render用于引用页面中的捆绑包,则应该关闭捆绑和缩小。BundleTable.EnableOptimizations = false将始终关闭捆绑和缩小(不管调试真/假标志)。
Scripts/Styles.Render
BundleTable.EnableOptimizations = false
您可能没有使用Scripts/Styles.Render助手吗?如果您通过直接渲染对捆绑包的引用,BundleTable.Bundles.ResolveBundleUrl()您将始终获得缩小/捆绑的内容。
BundleTable.Bundles.ResolveBundleUrl()