亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

ASP.NET Bundles如何禁用縮小

ASP.NET Bundles如何禁用縮小

HUWWW 2019-09-20 15:18:46
我debug="true"在我的web.config(s)中,我只是不希望我的捆綁縮小,但我沒做什么似乎禁用它。我試過了enableoptimisations=false,這是我的代碼://Javascriptbundles.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));//CSSbundles.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))
查看完整描述

3 回答

?
青春有我

TA貢獻1784條經驗 獲得超8個贊

如果您debug="true"web.config中并且正在使用Scripts/Styles.Render引用頁面中的包,那么應該關閉捆綁和縮小。BundleTable.EnableOptimizations = false將始終關閉捆綁和縮小(無論調試真/假標志)。

你可能沒有使用Scripts/Styles.Render助手嗎?如果您通過直接呈現對包的引用,BundleTable.Bundles.ResolveBundleUrl()則始終會獲得縮小/捆綁的內容。


查看完整回答
反對 回復 2019-09-20
?
慕妹3146593

TA貢獻1820條經驗 獲得超9個贊

條件編譯指令是你的朋友:


#if DEBUG

            var jsBundle = new Bundle("~/Scripts/js");

#else

            var jsBundle = new ScriptBundle("~/Scripts/js");

#endif


查看完整回答
反對 回復 2019-09-20
  • 3 回答
  • 0 關注
  • 625 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號