Reputation: 6488
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/angularJs").Include(
"~/Scripts/angular.min.js"));
bundles.Add(new ScriptBundle("~/bundles/angularComponents").Include(
"~/Scripts/angular-route.min.js",
"~/Scripts/angular-local-storage.min.js",
"~/Scripts/loading-bar.min.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.min.css",
"~/Content/loading-bar.min.css",
"~/Content/font-awesome.min.css",
"~/Content/site.css"));
bundles.IgnoreList.Clear();
bundles.IgnoreList.Ignore("*angular-route.min.js", OptimizationMode.Always);
bundles.IgnoreList.Ignore("*angular-local-storage.min.js", OptimizationMode.Always);
bundles.IgnoreList.Ignore("*loading-bar.min.js", OptimizationMode.Always);
BundleTable.EnableOptimizations = true;
}
Here i want to remove this bundle (new ScriptBundle("~/bundles/angularComponents")
) from optimization. I have tried the above way, but it doesn't ignore from optimization. Files are combined as well. Can anybody tell me how can i ignore this specific bundle list ?
Upvotes: 2
Views: 2446
Reputation: 12040
Have you tried to comment out the mentioned lines below?
//bundles.Add(new ScriptBundle("~/bundles/angularComponents").Include(
//"~/Scripts/angular-route.min.js",
//"~/Scripts/angular-local-storage.min.js",
//"~/Scripts/loading-bar.min.js"));
Upvotes: 0
Reputation: 1163
You can try the bellow code.It will add the related script but do not minify.
var angularComponents = new ScriptBundle("~/bundles/angularComponents").Include(
"~/Scripts/angular-route.min.js",
"~/Scripts/angular-local-storage.min.js",
"~/Scripts/loading-bar.min.js"
);
bundles.Add(angularComponents);
angularComponents.Transforms.Clear();
Upvotes: 5
Reputation: 239380
If you don't want the scripts bundled, don't put them in a bundle. Am I missing something here? The sole purpose of creating bundles is to have a bunch of scripts joined together and minimized. If you don't want that, then just include the scripts directly on the page, and don't involve the bundler.
Upvotes: -1
Reputation: 19
ScriptBundle scriptBndl = new ScriptBundle("~/bundles/bootstrap");
scriptBndl.Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"
);
bundles.Add(scriptBndl);
BundleTable.EnableOptimizations = true;
Upvotes: 1