MVC4 Unification Strategy

I am using the new Bundling feature in ASP.NET MVC4. I currently have the following packages configured:

  • ~ / Js / jquery
  • ~ / Js / form
  • ~ / Js / bootstrap

Depending on the kind that I serve, I usually call a combination of these three (for example, the jquery package is required on the home page, and jquery + bootstrap is required on the contact page, and all three are required for forms).

My question is: was there a way to invoke three packages that will appear as a single file from the view? I do not want to create packages for every possible combination:

  • ~ / JS / formsAndBootstrap
  • ~ / JS / formsAndJQueryAndBootstrap
  • Etc...
+5
source share
2 answers

, . " " .

0
bundles.Add(new ScriptBundle("~/bundles/formsAndBootstrap").Include(
                             "~/Content/Scripts/jquery-1.7.2.js",
                             "~/Content/Scripts/bootstrap.js",
                             "~/Content/Scripts/form.js"))
0

All Articles