StyleBundle renders as ScriptBundle

My CSS StyleBundle

appears in tag <script>

instead of tag <link>

.

It makes me scratch my head. I keep looking for my typo, but everything looks fine.

This is my BundleConfig.cs

public static void RegisterBundles(BundleCollection bundles)
{
    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.validate*"));

    bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                "~/Scripts/modernizr-*"));

    bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
              "~/Scripts/bootstrap.js",
              "~/Scripts/respond.js"));

    bundles.Add(new StyleBundle("~/Content/css").Include(
              "~/Content/bootstrap.css",
              "~/Content/site.css"));


    bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
              "~/Content/themes/base/all.css"));

    BundleTable.EnableOptimizations = false;
}

      

This is the head from my _Layout.cshtml:

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/Content/themes/base/css")
    @RenderSection("head", required: false)
</head>

      

And this is how the HTML looks like:

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Home Page - My ASP.NET Application</title>
    <link href="/Content/bootstrap.css" rel="stylesheet"/>
<link href="/Content/site.css" rel="stylesheet"/>

    <script src="/Scripts/modernizr-2.6.2.js"></script>

    <script src="/Content/themes/base/all.css"></script>


</head>

      

The layout is a bit off, so something looks like it's up, but I can't see what. Why doesn't this make the css file in the tag <link>

?

+3


source to share


1 answer


In your layout, this line:

@Scripts.Render("~/Content/themes/base/css")

      



Should be:

@Styles.Render("~/Content/themes/base/css")

      

+7


source







All Articles