Skip to content

Commit 5b76476

Browse files
authored
Merge pull request #203 from aspnetboilerplate/fix/abp-6693
Fix bundle problem on published apps
2 parents 1b62c17 + a63550b commit 5b76476

File tree

11 files changed

+533
-481
lines changed

11 files changed

+533
-481
lines changed

src/AbpCompanyName.AbpProjectName.Core/AbpCompanyName.AbpProjectName.Core.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@
252252
<Compile Include="Configuration\AppSettingProvider.cs" />
253253
<Compile Include="Editions\EditionManager.cs" />
254254
<Compile Include="Features\FeatureValueStore.cs" />
255+
<Compile Include="Helpers\DebugHelper.cs" />
255256
<Compile Include="MultiTenancy\Tenant.cs" />
256257
<Compile Include="MultiTenancy\TenantManager.cs" />
257258
<Compile Include="Properties\AssemblyInfo.cs" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace AbpCompanyName.AbpProjectName.Helpers
2+
{
3+
public static class DebugHelper
4+
{
5+
public static bool IsDebug
6+
{
7+
get
8+
{
9+
#if DEBUG
10+
return true;
11+
#else
12+
return false;
13+
#endif
14+
}
15+
}
16+
}
17+
}

src/AbpCompanyName.AbpProjectName.WebMpa/AbpCompanyName.AbpProjectName.WebMpa.csproj

+2-6
Original file line numberDiff line numberDiff line change
@@ -573,9 +573,6 @@
573573
<Content Include="Content\toastr.min.css" />
574574
<Content Include="css\materialize.css" />
575575
<Content Include="css\style.css" />
576-
<Content Include="css\style.min.css">
577-
<DependentUpon>style.css</DependentUpon>
578-
</Content>
579576
<Content Include="css\themes\all-themes.css" />
580577
<Content Include="css\themes\all-themes.min.css" />
581578
<Content Include="css\themes\theme-amber.css" />
@@ -1570,7 +1567,6 @@
15701567
<Content Include="lib\famfamfam-flags\dist\png\zm.png" />
15711568
<Content Include="lib\famfamfam-flags\dist\png\zw.png" />
15721569
<Content Include="lib\famfamfam-flags\dist\sprite\famfamfam-flags.css" />
1573-
<Content Include="lib\famfamfam-flags\dist\sprite\famfamfam-flags.min.css" />
15741570
<Content Include="lib\famfamfam-flags\dist\sprite\famfamfam-flags.png" />
15751571
<Content Include="lib\Flot\.gitignore" />
15761572
<Content Include="lib\Flot\examples\ajax\index.html" />
@@ -1632,7 +1628,6 @@
16321628
<Content Include="lib\Flot\LICENSE.txt" />
16331629
<Content Include="lib\font-awesome\.gitignore" />
16341630
<Content Include="lib\font-awesome\css\font-awesome.css" />
1635-
<Content Include="lib\font-awesome\css\font-awesome.min.css" />
16361631
<Content Include="lib\font-awesome\HELP-US-OUT.txt" />
16371632
<Content Include="lib\jquery-countTo\example.html" />
16381633
<Content Include="lib\jquery-countTo\jquery.countTo.js" />
@@ -2745,7 +2740,7 @@
27452740
<Content Include="Content\toastr.less" />
27462741
<Content Include="Scripts\bootstrap.js" />
27472742
<Content Include="Scripts\bootstrap.min.js" />
2748-
<None Include="log4net.Production.config" />
2743+
<Content Include="log4net.Production.config" />
27492744
<None Include="Scripts\jquery-3.6.0.intellisense.js" />
27502745
<Content Include="Scripts\jquery-3.6.0.js" />
27512746
<Content Include="Scripts\jquery-3.6.0.min.js" />
@@ -2806,6 +2801,7 @@
28062801
<Compile Include="App_Start\BundleConfig.cs" />
28072802
<Compile Include="App_Start\AbpProjectNameNavigationProvider.cs" />
28082803
<Compile Include="App_Start\AbpProjectNameWebModule.cs" />
2804+
<Compile Include="App_Start\CssRewriteUrlTransformWrapper.cs" />
28092805
<Compile Include="App_Start\PageNames.cs" />
28102806
<Compile Include="App_Start\RouteConfig.cs" />
28112807
<Compile Include="App_Start\Startup.cs" />

src/AbpCompanyName.AbpProjectName.WebMpa/App_Start/BundleConfig.cs

+27-25
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1-
using System.Web.Optimization;
1+
using AbpCompanyName.AbpProjectName.Helpers;
2+
using System.Web.Optimization;
23

34
namespace AbpCompanyName.AbpProjectName.WebMpa
45
{
56
public static class BundleConfig
67
{
78
public static void RegisterBundles(BundleCollection bundles)
89
{
10+
BundleTable.EnableOptimizations = !DebugHelper.IsDebug;
911
bundles.IgnoreList.Clear();
1012

1113
bundles.Add(
1214
new StyleBundle("~/Bundles/account-vendor/css")
13-
.Include("~/fonts/roboto/roboto.css", new CssRewriteUrlTransform())
14-
.Include("~/fonts/material-icons/materialicons.css", new CssRewriteUrlTransform())
15-
.Include("~/lib/bootstrap/dist/css/bootstrap.css", new CssRewriteUrlTransform())
16-
.Include("~/lib/toastr/toastr.css", new CssRewriteUrlTransform())
17-
.Include("~/lib/famfamfam-flags/dist/sprite/famfamfam-flags.css", new CssRewriteUrlTransform())
18-
.Include("~/lib/font-awesome/css/font-awesome.css", new CssRewriteUrlTransform())
19-
.Include("~/lib/Waves/dist/waves.css", new CssRewriteUrlTransform())
20-
.Include("~/lib/animate.css/animate.css", new CssRewriteUrlTransform())
21-
.Include("~/css/materialize.css", new CssRewriteUrlTransform())
22-
.Include("~/css/style.css", new CssRewriteUrlTransform())
23-
.Include("~/Views/Account/_Layout.css", new CssRewriteUrlTransform())
15+
.Include("~/fonts/roboto/roboto.css", new CssRewriteUrlTransformWrapper())
16+
.Include("~/fonts/material-icons/materialicons.css", new CssRewriteUrlTransformWrapper())
17+
.Include("~/lib/bootstrap/dist/css/bootstrap.css", new CssRewriteUrlTransformWrapper())
18+
.Include("~/lib/toastr/toastr.css", new CssRewriteUrlTransformWrapper())
19+
.Include("~/lib/famfamfam-flags/dist/sprite/famfamfam-flags.css", new CssRewriteUrlTransformWrapper())
20+
.Include("~/lib/font-awesome/css/font-awesome.css", new CssRewriteUrlTransformWrapper())
21+
.Include("~/lib/Waves/dist/waves.css", new CssRewriteUrlTransformWrapper())
22+
.Include("~/lib/animate.css/animate.css", new CssRewriteUrlTransformWrapper())
23+
.Include("~/css/materialize.css", new CssRewriteUrlTransformWrapper())
24+
.Include("~/css/style.css", new CssRewriteUrlTransformWrapper())
25+
.Include("~/Views/Account/_Layout.css", new CssRewriteUrlTransformWrapper())
2426
);
2527

2628
bundles.Add(
@@ -53,19 +55,19 @@ public static void RegisterBundles(BundleCollection bundles)
5355
//~/Bundles/vendor/css
5456
bundles.Add(
5557
new StyleBundle("~/Bundles/vendor/css")
56-
.Include("~/fonts/roboto/roboto.css", new CssRewriteUrlTransform())
57-
.Include("~/fonts/material-icons/materialicons.css", new CssRewriteUrlTransform())
58-
.Include("~/lib/bootstrap/dist/css/bootstrap.css", new CssRewriteUrlTransform())
59-
.Include("~/lib/bootstrap-select/dist/css/bootstrap-select.css", new CssRewriteUrlTransform())
60-
.Include("~/lib/toastr/toastr.css", new CssRewriteUrlTransform())
61-
.Include("~/lib/famfamfam-flags/dist/sprite/famfamfam-flags.css", new CssRewriteUrlTransform())
62-
.Include("~/lib/font-awesome/css/font-awesome.css", new CssRewriteUrlTransform())
63-
.Include("~/lib/Waves/dist/waves.css", new CssRewriteUrlTransform())
64-
.Include("~/lib/animate.css/animate.css", new CssRewriteUrlTransform())
65-
.Include("~/css/materialize.css", new CssRewriteUrlTransform())
66-
.Include("~/css/style.css", new CssRewriteUrlTransform())
67-
.Include("~/css/themes/all-themes.css", new CssRewriteUrlTransform())
68-
.Include("~/Views/Shared/_Layout.css", new CssRewriteUrlTransform())
58+
.Include("~/fonts/roboto/roboto.css", new CssRewriteUrlTransformWrapper())
59+
.Include("~/fonts/material-icons/materialicons.css", new CssRewriteUrlTransformWrapper())
60+
.Include("~/lib/bootstrap/dist/css/bootstrap.css", new CssRewriteUrlTransformWrapper())
61+
.Include("~/lib/bootstrap-select/dist/css/bootstrap-select.css", new CssRewriteUrlTransformWrapper())
62+
.Include("~/lib/toastr/toastr.css", new CssRewriteUrlTransformWrapper())
63+
.Include("~/lib/famfamfam-flags/dist/sprite/famfamfam-flags.css", new CssRewriteUrlTransformWrapper())
64+
.Include("~/lib/font-awesome/css/font-awesome.css", new CssRewriteUrlTransformWrapper())
65+
.Include("~/lib/Waves/dist/waves.css", new CssRewriteUrlTransformWrapper())
66+
.Include("~/lib/animate.css/animate.css", new CssRewriteUrlTransformWrapper())
67+
.Include("~/css/materialize.css", new CssRewriteUrlTransformWrapper())
68+
.Include("~/css/style.css", new CssRewriteUrlTransformWrapper())
69+
.Include("~/css/themes/all-themes.css", new CssRewriteUrlTransformWrapper())
70+
.Include("~/Views/Shared/_Layout.css", new CssRewriteUrlTransformWrapper())
6971
);
7072

7173
//~/Bundles/vendor/bottom (Included in the bottom for fast page load)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Web.Optimization;
2+
using System.Web;
3+
4+
public class CssRewriteUrlTransformWrapper : IItemTransform
5+
{
6+
public string Process(string includedVirtualPath, string input)
7+
{
8+
return new CssRewriteUrlTransform().Process("~" + VirtualPathUtility.ToAbsolute(includedVirtualPath), input);
9+
}
10+
}

0 commit comments

Comments
 (0)