Skip to content

Commit 9e6ccfa

Browse files
committed
Bundling for durandal template.
1 parent df796b3 commit 9e6ccfa

File tree

18 files changed

+2366
-17
lines changed

18 files changed

+2366
-17
lines changed

Templates/All-In-One-Template/MySpaProject/MySpaProject.WebSpaAngular/App_Start/BundleConfig.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ public static void RegisterBundles(BundleCollection bundles)
6060

6161
//APPLICATION RESOURCES
6262

63-
//~/Bundles/App/Main/css //TODO: Does it includes both .css and .min.css?
63+
//~/Bundles/App/Main/css
6464
bundles.Add(
6565
new StyleBundle("~/Bundles/App/Main/css")
6666
.IncludeDirectory("~/App/Main", "*.css", true)
6767
);
6868

69-
//~/Bundles/App/Main/js //TODO: Does it includes both .js and .min.js?
69+
//~/Bundles/App/Main/js
7070
bundles.Add(
7171
new ScriptBundle("~/Bundles/App/Main/js")
7272
.IncludeDirectory("~/App/Main", "*.js", true)
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
using System.Web.Optimization;
2+
3+
namespace MySpaProject.WebSpaDurandal
4+
{
5+
public static class BundleConfig
6+
{
7+
public static void RegisterBundles(BundleCollection bundles)
8+
{
9+
bundles.IgnoreList.Clear();
10+
11+
//VENDOR RESOURCES
12+
13+
//~/Bundles/App/vendor/css
14+
bundles.Add(
15+
new StyleBundle("~/Bundles/App/vendor/css")
16+
.Include(
17+
"~/Content/themes/base/all.css",
18+
"~/Content/bootstrap-cosmo.min.css",
19+
"~/Content/durandal.css",
20+
"~/Content/toastr.min.css",
21+
"~/Content/flags/famfamfam-flags.css",
22+
"~/Content/font-awesome.min.css"
23+
)
24+
);
25+
26+
//~/Bundles/vendor/js/top (These scripts should be included in the head of the page)
27+
bundles.Add(
28+
new ScriptBundle("~/Bundles/vendor/js/top")
29+
.Include(
30+
"~/Abp/Framework/scripts/utils/ie10fix.js",
31+
"~/Scripts/modernizr-2.8.3.js"
32+
)
33+
);
34+
35+
//~/Bundles/vendor/bottom (Included in the bottom for fast page load)
36+
bundles.Add(
37+
new ScriptBundle("~/Bundles/vendor/js/bottom")
38+
.Include(
39+
"~/Scripts/json2.min.js",
40+
41+
"~/Scripts/jquery-2.1.1.min.js",
42+
"~/Scripts/jquery-ui.min-1.11.1.js",
43+
44+
"~/Scripts/bootstrap.min.js",
45+
46+
"~/Scripts/jquery.validate.min.js",
47+
"~/Scripts/jquery.blockUI.min.js",
48+
"~/Scripts/toastr.min.js",
49+
"~/Scripts/others/spinjs/spin.js",
50+
"~/Scripts/others/spinjs/jquery.spin.js",
51+
52+
"~/Scripts/knockout-3.2.0.js",
53+
"~/Scripts/knockout.mapping-latest.js",
54+
55+
"~/Abp/Framework/scripts/abp.js",
56+
"~/Abp/Framework/scripts/libs/abp.jquery.js",
57+
"~/Abp/Framework/scripts/libs/abp.toastr.js",
58+
"~/Abp/Framework/scripts/libs/abp.blockUI.js",
59+
"~/Abp/Framework/scripts/libs/abp.spin.js"
60+
)
61+
);
62+
63+
//APPLICATION RESOURCES
64+
65+
//~/Bundles/App/Main/css
66+
bundles.Add(
67+
new StyleBundle("~/Bundles/App/Main/css")
68+
.IncludeDirectory("~/App/Main", "*.css", true)
69+
);
70+
}
71+
}
72+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using Abp.Application.Navigation;
2+
using Abp.Localization;
3+
4+
namespace MySpaProject.WebSpaDurandal
5+
{
6+
/// <summary>
7+
/// This class defines menus for the application.
8+
/// It uses ABP's menu system.
9+
/// When you add menu items here, they are automatically appear in angular application.
10+
/// See .cshtml and .js files under App/Main/views/layout/header to know how to render menu.
11+
/// </summary>
12+
public class MySpaProjectNavigationProvider : INavigationProvider
13+
{
14+
public void SetNavigation(INavigationProviderContext context)
15+
{
16+
context.Manager.MainMenu
17+
.AddItem(
18+
new MenuItemDefinition(
19+
"Home",
20+
new LocalizableString("HomePage", MySpaProjectConsts.LocalizationSourceName),
21+
url: "#",
22+
icon: "fa fa-home"
23+
)
24+
).AddItem(
25+
new MenuItemDefinition(
26+
"About",
27+
new LocalizableString("About", MySpaProjectConsts.LocalizationSourceName),
28+
url: "#about",
29+
icon: "fa fa-info"
30+
)
31+
);
32+
}
33+
}
34+
}
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
using System.Reflection;
22
using System.Web;
33
using System.Web.Mvc;
4+
using System.Web.Optimization;
45
using System.Web.Routing;
56
using Abp.Localization;
67
using Abp.Localization.Sources.Xml;
78
using Abp.Modules;
89

910
namespace MySpaProject.WebSpaDurandal
1011
{
11-
[DependsOn(typeof(MySpaProjectDataModule),typeof(MySpaProjectApplicationModule),typeof(MySpaProjectWebApiModule))]
12+
[DependsOn(typeof(MySpaProjectDataModule), typeof(MySpaProjectApplicationModule), typeof(MySpaProjectWebApiModule))]
1213
public class MySpaProjectWebModule : AbpModule
1314
{
1415
public override void PreInitialize()
1516
{
17+
//Add/remove languages for your application
1618
Configuration.Localization.Languages.Add(new LanguageInfo("en", "English", "famfamfam-flag-england", true));
1719
Configuration.Localization.Languages.Add(new LanguageInfo("tr", "Türkçe", "famfamfam-flag-tr"));
20+
21+
//Configure navigation/menu
22+
Configuration.Navigation.Providers.Add<MySpaProjectNavigationProvider>();
1823
}
1924

2025
public override void Initialize()
@@ -23,13 +28,14 @@ public override void Initialize()
2328

2429
Configuration.Localization.Sources.Add(
2530
new XmlLocalizationSource(
26-
"MySpaProject",
31+
MySpaProjectConsts.LocalizationSourceName,
2732
HttpContext.Current.Server.MapPath("~/Localization/MySpaProject")
2833
)
2934
);
3035

3136
AreaRegistration.RegisterAllAreas();
3237
RouteConfig.RegisterRoutes(RouteTable.Routes);
38+
BundleConfig.RegisterBundles(BundleTable.Bundles);
3339
}
3440
}
3541
}

0 commit comments

Comments
 (0)