BundleConfig.cs的用法


本文簡單講一下mvc4中關於前端的一個新功能——js與css的壓縮與合並。BundleConfig.cs就是用來配置這些css、js的。

bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-1.*"));
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
這兩個就是配置js路徑跟css路徑,當然路徑可以有多個,Include傳遞的參數為數組,可以把要添加的js跟css都放上去。例bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"," /Content/themes/default/typography.css"));


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM