Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Services.WebApp/3.3/Configs/BundleConfig.cs @ 12428

Last change on this file since 12428 was 12428, checked in by ascheibe, 9 years ago

#2394 added web app and status page to trunk

File size: 3.6 KB
Line 
1using System.Collections.Generic;
2using System.IO;
3using System.Linq;
4using System.Web;
5using System.Web.Optimization;
6
7namespace HeuristicLab.Services.WebApp.Configs {
8  public class BundleConfig {
9    public static void RegisterBundles(BundleCollection bundles) {
10      bundles.IgnoreList.Clear();
11
12      // IESupport
13      bundles.Add(new ScriptBundle("~/Bundles/IESupport").Include(
14        "~/WebApp/libs/misc/html5shiv.min.js",
15        "~/WebApp/libs/misc/respond.min.js"
16      ));
17
18      // Vendors
19      bundles.Add(new StyleBundle("~/Bundles/Vendors/css").Include(
20        "~/WebApp/libs/bootstrap/css/bootstrap.min.css",
21        "~/WebApp/libs/bootstrap/css/bootstrap-theme.min.css",
22        "~/WebApp/libs/font-aweseome/font-aweseome.min.css",
23        "~/WebApp/libs/angularjs/loading-bar/loading-bar.css"
24      ));
25
26      bundles.Add(new ScriptBundle("~/Bundles/Vendors/js").Include(
27        // jquery
28        "~/WebApp/libs/jquery/jquery-2.1.4.min.js",
29        "~/WebApp/libs/jquery/jquery-ui/jquery-ui-1.11.4.min.js",
30        "~/WebApp/libs/jquery/jquery-knob/jquery.knob.min.js",
31        "~/WebApp/libs/jquery/jquery-flot/excanvas.min.js",
32        "~/WebApp/libs/jquery/jquery-flot/jquery.flot.min.js",
33        "~/WebApp/libs/jquery/jquery-flot/jquery.flot.time.min.js",
34        "~/WebApp/libs/jquery/jquery-flot/jquery.flot.selection.min.js",
35        "~/WebApp/libs/jquery/jquery-flot/jquery.flot.navigate.min.js",
36        "~/WebApp/libs/jquery/jquery-flot/jquery.flot.resize.min.js",
37        "~/WebApp/libs/jquery/jquery-flot/jquery.flot.stack.min.js",
38        // bootstrap
39        "~/WebApp/libs/bootstrap/js/bootstrap.min.js",
40        // angular js
41        "~/WebApp/libs/angularjs/angular.min.js",
42        "~/WebApp/libs/angularjs/angular-route.min.js",
43        "~/WebApp/libs/angularjs/angular-aria.min.js",
44        "~/WebApp/libs/angularjs/angular-cookies.min.js",
45        "~/WebApp/libs/angularjs/angular-loader.min.js",
46        "~/WebApp/libs/angularjs/angular-messages.min.js",
47        "~/WebApp/libs/angularjs/angular-resource.min.js",
48        "~/WebApp/libs/angularjs/angular-sanitize.min.js",
49        "~/WebApp/libs/angularjs/angular-touch.min.js",
50        "~/WebApp/libs/angularjs/angular-ui-router.min.js",
51        "~/WebApp/libs/angularjs/angular-knob/angular-knob.js",
52        "~/WebApp/libs/angularjs/angular-ui/ui-bootstrap-tpls-0.13.0.min.js",
53        "~/WebApp/libs/angularjs/loading-bar/loading-bar.js",
54        "~/WebApp/libs/angularjs/ocLazyLoad/ocLazyLoad.min.js",
55        // smoothScroll
56        "~/WebApp/libs/smoothScroll/smoothScroll.js"
57      ));
58
59      // Application
60      bundles.Add(new StyleBundle("~/Bundles/WebApp/css").Include(
61        "~/WebApp/app.css"
62      ));
63      AddOrUpdateWebAppBundle();
64    }
65
66    public static void AddOrUpdateWebAppBundle() {
67      var jsBundle = BundleTable.Bundles.GetBundleFor("~/Bundles/WebApp/js");
68      if (jsBundle != null) {
69        BundleTable.Bundles.Remove(jsBundle);
70      }
71      var jsFiles = new List<string> {
72        "~/WebApp/helper.js",
73        "~/WebApp/app.js"
74      };
75      var directories = Directory.GetDirectories(string.Format(@"{0}WebApp\plugins", HttpRuntime.AppDomainAppPath));
76      jsFiles.AddRange(directories.Select(Path.GetFileName).Select(directory => string.Format("~/WebApp/plugins/{0}/{0}.js", directory)));
77      jsFiles.Add("~/WebApp/main.js");
78      jsBundle = new ScriptBundle("~/Bundles/WebApp/js");
79      jsBundle.Include(jsFiles.ToArray());
80      jsBundle.IncludeDirectory("~/WebApp/shared/", "*.js", true);
81      BundleTable.Bundles.Add(jsBundle);
82    }
83  }
84}
Note: See TracBrowser for help on using the repository browser.