I have the following configuration:
public static void RegisterBundles(BundleCollection bundles)
{
var picbundle = new ScriptBundle("~/bundles/pic.components")
.IncludeDirectory("~/TypeScript/Components","*.js",true)
.IncludeDirectory("~/TypeScript/Services", "*.js", true);
bundles.Add(picbundle);
}
Inside the components folder there is files needed to be loaded before others.I am using wild card to load all javascript files because my boss thought it's cleaner and easier than writing each file name.
I found this solution over stack overflow , which implement your own custom bundle to load files in the right order.
I tried to do it this way,but I'm not sure I'm using it right because it's not working
public IEnumerable<BundleFile> OrderFiles(BundleContext context, IEnumerable<BundleFile> files)
{
return files;
}
}
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
var picbundle = new ScriptBundle("~/bundles/pic.components")
.Include("~/TypeScript/Components/LogEntry/_Shared/components.log-entry.js").
Include("~/TypeScript/Components/LogEntry/_Shared/notifcationProjectLogEntryViewmodel.js")
.IncludeDirectory("~/TypeScript/Components","*.js",true)
.IncludeDirectory("~/TypeScript/Services", "*.js", true);
picbundle.Orderer = new FirstBundelOrder();
bundles.Add(picbundle);
}
}