Link to home
Start Free TrialLog in
Avatar of WorknHardr
WorknHardr

asked on

.NET MVC5 Bundle Config Layout?

I'm trying to layout our new MVC5 bundles to separate scripts accordingly. I say "Why load more scripts in the Layout page then necessary?" Anyway, here's my layout so far.

Q. Does this look correct?

 public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

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

            bundles.Add(new ScriptBundle("~/bundles/jquery-ajax").Include(
                        "~/Scripts/jquery.unobtrusive-ajax.js"));

            bundles.Add(new ScriptBundle("~/bundles/jquery-ui").Include(
                        "~/Scripts/jquery-ui-1.11.0.js"));
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WorknHardr
WorknHardr

ASKER

ah, as far as grouping scripts. I don't want to guess if its correct. Maybe there is a better way to group?
Off Topic:
   No more points for questions at EE?
They default to 500 now. The multiplier (that you add if you grade as "A" , "B", "C") still apply, though. EE changed this a week or so ago.
Also, I would say you bundle together everything that would make sense to go together in order to make some piece of functionality (or styling) work if you add the bundle to a page. For instance, you might be using JQuery UI for some visual components. But JQuery UI depends on JQuery, so you might bundle the two together into one bundle. In this way, you ensure whichever page that receives the bundle will have both libraries available to it.