public static void RegisterBundles(BundleCollection bundles, BundleOptions bundleOptions = null)
 {
     if (bundleOptions == null)
     {
         bundleOptions = new BundleOptions();
     }
     BundleTable.Bundles.Clear();
     BundleTable.Bundles.ResetAll();
     CreateLessBundles();
     CreateJsBundles(bundleOptions);
     //CreateScssBundles();
     //CreateCssBundles();
 }
        private static void CreateJsBundles(BundleOptions bundleOptions)
        {
            var jsFiles = GetFiles(bundleOptions.RelativeJsFolderPath ?? "/Scripts/Views/", ".js");

            foreach (var source in jsFiles)
            {
                var dependencies = GetDependencies(source);

                var bundlePath = "~/bundles/" + source.Name.Split('.')[0];
                var bundle = new Bundle(bundlePath);

                foreach (var dependency in dependencies.Distinct())
                {
                    bundle.Include(dependency);
                }

                if (source.Directory != null)
                {
                    bundle.Include((bundleOptions.RelativeJsFolderPath ?? "~/Scripts/Views/") + source.Directory.Name + "/" + source.Name);
                }

            #if !DEBUG
                    bundle.Transforms.Add(new JsMinify());
            #endif

                BundleTable.Bundles.Add(bundle);
            }

            #if !DEBUG
                BundleTable.EnableOptimizations = true;
            #endif
        }