BundleConfig does not load all CSS files

0

I am trying to load the jquery-ui.css CSS and jquery-ui.theme.css CSS files by creating a bundle, but the bundle insists on loading only the default CSS of ASP.NET MVC than site.css . To work, I always have to load the additional CSS files using the <link> tag. Where am I going wrong?

BundleConfig

public class BundleConfig
{
    public static void RegisterBundles(BundleCollection bundles)
    {
        BundleTable.EnableOptimizations = true;

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

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

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

        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.css",
                    "~/Content/themes/base/jquery.ui.theme.css"));
        }
}

_Layout.cshtml

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    @*<link href="~/Content/themes/base/css/jquery-ui.css" rel="stylesheet" />
    <link href="~/Content/themes/base/css/jquery-ui.theme.css" rel="stylesheet" />*@

    @Styles.Render("~/Content/themes/base/css", "~/Content/css")
    @Scripts.Render("~/bundles/modernizr")

</head>
<body>

    <h2>Menu Sistema</h2>

    @RenderPage("~/Views/Shared/_Menu.cshtml")

    @RenderBody()

    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/jqueryui")
    @RenderSection("scripts", required: false)
</body>
</html>

CSS files

    
asked by anonymous 11.10.2015 / 03:19

1 answer

2

There is a small misspelling in your configuration. Note that your Bundle is like:

bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                "~/Content/themes/base/jquery.ui.css",
                "~/Content/themes/base/jquery.ui.theme.css"));
    }

For your image, it should be:

bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                "~/Content/themes/base/css/jquery-ui.css",
                "~/Content/themes/base/css/jquery-ui.theme.css"));
    }
    
13.10.2015 / 16:13