码迷,mamicode.com
首页 > Web开发 > 详细

MVC认知路【点点滴滴支离破碎】【四】----捆绑和缩小(BundleConfig.RegisterBundles)

时间:2015-07-13 13:40:24      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:

原文链接:http://www.asp.net/mvc/overview/performance/bundling-and-minification

 

打开App_Start\BundleConfig.cs文件并检查的 RegisterBundles 方法,用于创建、 注册和配置包。下面的代码演示RegisterBundles 方法的部分。

         // 有关 Bundling 的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=254725
        public static void RegisterBundles(BundleCollection bundles)
        {

            ResetIgnorePatterns(bundles.IgnoreList);
        

            bundles.Add(new StyleBundle("~/bundles/css").Include(
                "~/Content/css/common.css",
                "~/Content/font/iconfont.css",
                 "~/Content/css/style.css"

            ));
        }
2、页面调用

1 @Scripts.Render("~/bundles/jq")    
2 @Scripts.Render("~/bundles/ko")    
3 @Scripts.Render("~/bundles/comm")    
4 @Scripts.Render("~/bundles/layer")    
5 @RenderSection("scripts", required: false) 
6 @section scripts{
7         <script type="text/javascript" src="/Content/js/layerIndustry.js"></script>    
8 }

 

MVC认知路【点点滴滴支离破碎】【四】----捆绑和缩小(BundleConfig.RegisterBundles)

标签:

原文地址:http://www.cnblogs.com/oiliu/p/4642507.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!