bundles.Add( )下無法綁定尾碼為min.css的檔案

來源:互聯網
上載者:User

標籤:cin   尾碼   led   顯示   script   模式   content   alt   elinks   

1.問題描述:在綁定css的時候,除了尾碼名為.min.css的檔案,在render.style()不顯示外,其他的css都正常載入,2.解決辦法:
  1. 這個是我在調試了幾遍之後發現的規律,然後解決辦法很簡單:
    就是把.min.css的檔案改成名為.css的檔案就好了。                                                                                                                   bundles.Add(new StyleBundle("~/Content/BootStrap/css").Include("~/Content/BootStrap/bootstrap.min.css"));                          改成bundles.Add(new StyleBundle("~/Content/BootStrap/css").Include("~/Content/BootStrap/bootstrap.css"));
  2. 但是這樣做有一個不好之處,
    這樣會在以後的時候會忘記css是min.css檔案。

  3. 有的人說在bundleConfig類的RegisterBundles方法下設定屬性可以解決此問題:
    BundleTable.EnableOptimizations = false;但是由本人親自調試並沒有反應。所以此解決方案被朕打入了冷宮。
3.擴充:
  1. 在使用Include()方法的時候可以使用萬用字元,大大減少了工作量。bundles.Add(new StyleBundle("~/Content/BootStrap/css").Include("~/Content/BootStrap/*.css"));                                        該*代表的是在~/Content/BootStrap/下的所有.css檔案都會被綁定。
  2. 下面這張表是萬用字元的法則:  表格引用於作者--zhou44129879  網址:http://blog.csdn.net/zhou44129879/article/details/16818987                                                                                                                                                                                               
    匹配格式 添加檔案或引發異常
    Include("~/Scripts/Common/*.js") AddAltToImg.js,ToggleDiv.js,ToggleImg.js
    Include("~/Scripts/Common/T*.js")
    無效的模式的異常。萬用字元字元只允許對的首碼或尾碼。
    Include("~/Scripts/Common/*og.*") 無效的模式的異常。只有一個萬用字元字元被允許
    "Include("~/Scripts/Common/T*")
    ToggleDiv.js ToggleImg.js
    "Include("~/Scripts/Common/*") 無效的模式的異常。一個純萬用字元段不是有效
    IncludeDirectory ("~/Scripts/Common","T *") ToggleDiv.js ToggleImg.js
    IncludeDirectory("~/Scripts/Common", "T*",true)
    ToggleDiv.js,ToggleImg.js,ToggleLinks.js

bundles.Add( )下無法綁定尾碼為min.css的檔案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.