Thursday 3 December 2015

Change order of files in bundling



 
  public class BundleConfig
    {
        public static void RegisterBundles(BundleCollection bundles)
        {
            var JS = new ScriptBundle("~/Content/Dashboard").Include(
                                                  "~/Content/assets/plugins/gridmove/src/underscore-min.js",
                                                  "~/Content/assets/plugins/gridmove/src/knockout-min.js",
                                                  "~/Content/weather/weather.js");
            JS.Orderer = new CustomBundleOrderer();
            bundles.Add(JS);
        }
    }

    class CustomBundleOrderer : IBundleOrderer
    {
        public IEnumerable<FileInfo> OrderFiles(BundleContext context, IEnumerable<FileInfo> files)
        {
            return files; // Do your ordering related stuffs
        }
    }

No comments:

Post a Comment