How to apply custom batch order?

I am playing with the new ASP.NET layout function and it seems like I can't get my custom order to work. Here are my JS files:

bootstrap.js
bootstrap.min.js
jquery-1.7.2.intellisense.js
jquery-1.7.2.js
jquery-1.7.2.min.js
jquery-ui-1.8.19.js
jquery-ui-1.8.19.min.js
jquery.unobtrusive-ajax.js
jquery.unobtrusive-ajax.min.js

I would like the builder to output boostrap * .js in front of all jQuery files. I understand that internally the bundle will sort the jQuery files on top, so I tried to interrupt the logic without errors:

var bootstrapOrdering = new BundleFileSetOrdering("bootstrap");            
bootstrapOrdering.Files.Add("bootstrap*.js");            
bootstrapOrdering.Files.Add("jquery*.js");
BundleTable.Bundles.FileSetOrderList.Add(bootstrapOrdering);

Note. I would prefer to use a wildcard, if possible, to cover all cases without specifying all the files in the code.

Does anyone know if I can apply my order?

thank

+5
source share
1 answer

You almost had it, the little thing you missed was just pasting your order at the top of the list.

BundleTable.Bundles.FileSetOrderList.Add(bootstrapOrdering);

it should be:

BundleTable.Bundles.FileSetOrderList.Insert(0, bootstrapOrdering).

jquery *.js , *.js jquery.

+7

All Articles