将样式表放到MVC4中的bundleConfig时,Bootstrap样式表无法呈现

时间:2013-08-16 11:26:12

标签: asp.net-mvc-4 twitter-bootstrap assets

我试图在bundleConfig中为mvc4项目添加Bootstrap样式表,但是当我查看源代码时样式表无法呈现,所以我遇到了设计问题。我的代码如下:

   <link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.min.css"> 
   <script type="text/javascript" src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>  
  <script type="text/javascript" src="assets/js/jquery-1.8.2.min.js"></script>

我的bundleConfig代码

  

public static void RegisterBundles(BundleCollection bundle)

    {
        bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-{version}.js"));

        bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                    "~/Scripts/jquery-ui-{version}.js"));

        bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                    "~/Scripts/jquery.unobtrusive*",
                    "~/Scripts/jquery.validate*"));

        // Use the development version of Modernizr to develop with and learn from. Then, when you're
        // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
        bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                    "~/Scripts/modernizr-*"));
        bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
        bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                    "~/Content/themes/base/jquery.ui.core.css",
                    "~/Content/themes/base/jquery.ui.resizable.css",
                    "~/Content/themes/base/jquery.ui.selectable.css",
                    "~/Content/themes/base/jquery.ui.accordion.css",
                    "~/Content/themes/base/jquery.ui.autocomplete.css",
                    "~/Content/themes/base/jquery.ui.button.css",
                    "~/Content/themes/base/jquery.ui.dialog.css",
                    "~/Content/themes/base/jquery.ui.slider.css",
                    "~/Content/themes/base/jquery.ui.tabs.css",
                    "~/Content/themes/base/jquery.ui.datepicker.css",
                    "~/Content/themes/base/jquery.ui.progressbar.css",
                    "~/Content/themes/base/jquery.ui.theme.css",
                    "~/assets/plugins/bootstrap/css/bootstrap.min.css" ));
        bundles.Add(new StyleBundle("~/assets").Include(
                                "~/assets/css/headers/header1.css",
                                "~/assets/plugins/bootstrap/css/bootstrap-responsive.min.css",
                                "~/assets/css/style_responsive.css",
                                "~/assets/plugins/font-awesome/css/font-awesome.css",
                                "~/assets/plugins/parallax-slider/css/parallax-slider.css",
                                "~/assets/style.css"));
        BundleTable.EnableOptimizations = true;
          }

你能帮我吗?

1 个答案:

答案 0 :(得分:1)

默认情况下,将忽略缩小的脚本。所以你有两个选择:

  1. 从引导程序css文件名中删除.min。
  2. 清除IgnoreList。
  3. 做其中一个就足够了。