ASP.NET束如何禁用缩小 [英] ASP.NET Bundles how to disable minification

查看:151
本文介绍了ASP.NET束如何禁用缩小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

调试=真正的在这两个我的的web.config(S)的,我只是不希望我的包精缩,但没有我这样做似乎禁用它。我试过 enableoptimisations = FALSE ,这里是我的code:

  //的Javascript
bundles.Add(新ScriptBundle(〜/包/ MainJS)
            .INCLUDE(〜/脚本/常规/ lib中/ MVC / jquery.validate.unobtrusive.js *)
            .INCLUDE(〜/脚本/常规/ lib中/ MVC / jquery.validate *)
            .INCLUDE(〜/脚本/常规/ lib目录/ bootstrap.js)
            .IncludeDirectory(〜/脚本/常规/模块,* .js文件,真)
            .IncludeDirectory(〜/脚本/常规/页,* .js文件,真)
            .IncludeDirectory(〜/脚本/常规/杂项,* .js文件,真正的));// CSS
bundles.Add(新StyleBundle(〜/包/ MainCSS)
            .INCLUDE(〜/内容/ CSS /常规/ lib中/ bootstrap.css *)
            .IncludeDirectory(〜/内容/ CSS /常规/模块,*。的CSS,真)
            .IncludeDirectory(〜/内容/ CSS /常规/页,*。的CSS,真))


解决方案

如果您有调试=真正的中的的web.config 的和使用脚本/ Styles.Render 引用捆绑在您的网页,应同时关闭捆绑和缩小。 EnableOptimizations = FALSE 将始终关闭两者捆绑和缩小以及(不论调试真/假标志)。

您也许不是使用脚本/ Styles.Render 助手?如果您是直接通过 BundleTable.Bundles.ResolveBundleUrl渲染包引用()你总是会得到的精缩/捆绑的内容。

I have debug="true" in both my web.config(s), and I just don't want my bundles minified, but nothing I do seems to disable it. I've tried enableoptimisations=false, here is my code:

//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))

解决方案

If you have debug="true" in web.config and are using Scripts/Styles.Render to reference the bundles in your pages, that should turn off both bundling and minification. EnableOptimizations = false will always turn off both bundling and minification as well (irrespective of the debug true/false flag).

Are you perhaps not using the Scripts/Styles.Render helpers? If you are directly rendering references to the bundle via BundleTable.Bundles.ResolveBundleUrl() you will always get the minified/bundled content.

这篇关于ASP.NET束如何禁用缩小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆