4

This is what I did so far

bundles.Add(new ScriptBundle("~/bundles/WebformsJS").Include(
      "~/Scripts/WebForms/WebForms.js",
      "~/Scripts/WebForms/WebUIValidation.js",
      "~/Scripts/WebForms/MenuStandards.js",
      "~/Scripts/WebForms/Focus.js",
      "~/Scripts/WebForms/GridView.js",
      "~/Scripts/WebForms/DetailsView.js",
      "~/Scripts/WebForms/TreeView.js",
      "~/Scripts/WebForms/WebParts.js"));

bundles.Add(new ScriptBundle("~/bundles/MsAjaxJS").Include(
    "~/Scripts/WebForms/MsAjax/MicrosoftAjax.js",
    "~/Scripts/WebForms/MsAjax/MicrosoftAjaxApplicationServices.js",
    "~/Scripts/WebForms/MsAjax/MicrosoftAjaxTimer.js",
    "~/Scripts/WebForms/MsAjax/MicrosoftAjaxWebForms.js"));


bundles.Add(new ScriptBundle("~/bundles/MegaJS").
    .Include("~/bundles/WebformsJS")
    .Include("~/bundles/MsAjaxJS"));

Then I render the MegaBundle in Site.Master file like this:

 <%: Scripts.Render("~/bundles/MegaJS") %> 

The application run with no errors, but when I View Page source I can see the include

<script src="/bundles/MegaJS?v="></script>

If you notice the version is blank and when I click the bundle script its empty

My questions are: 1) Does creating bundle from other bundle's is supported 2) If Yes! then is their an example I can follow.

2
  • The question is, why you want to combine the two bundles? We have the situation, that on some pages we only need the WebForms bundle and on others we need both. But it then makes sense to have them separted, cause likely the client already has the webforms bundle. At least in our case. Commented Nov 27, 2012 at 16:31
  • @Remy I have upgraded legacy site to 4.5 that uses its own bundling logic and it has the feature to make bundle from bundles. So in order to reduce less work modifying legacy code I would like to know if the feature is supported. Commented Nov 27, 2012 at 16:42

1 Answer 1

1

No, currently you cannot include bundles within bundles, you can only include real assets. This is something we have on our todo list for asset management though. You can upvote this if this is a feature you desire here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.