1
votes

Given these bundles:

     public static void RegisterBundles(BundleCollection bundles)
     {
        // 3rd party scripts
        bundles.Add(new ScriptBundle("~/scripts")
            .IncludeDirectory("~/Scripts/", "*.js"));            

        // my scripts
        bundles.Add(new ScriptBundle("~/myscripts")
            .IncludeDirectory("~/MyScripts/", "*.js"));
     }

During development it would be helpful to bundle just the first bundle, the 3rd party scripts, but not the second.

Is there any way to specify that one bundle shall be bundled and maybe even minified, but the other one not?

I thought about adding something like

 BundleTable.EnableOptimizations = true;

but this would bundle all bundles. On the other hand, the bundle classes, like ScriptBundle have no members that would allow me to force their bundling.

1

1 Answers

0
votes

Add a transform on the specific bundle, like this :

Bundle bundle = new ScriptBundle("~/scripts")
                    .IncludeDirectory("~/Scripts/", "*.js");
bundle.Transforms.Add(new JsMinify());
bundles.Add(bundle);