Browse Source

Add Bundling system

pull/41/head
liangshiwei 7 months ago
parent
commit
124a73f957
  1. 12
      Directory.Packages.props
  2. 2
      common.props
  3. 7
      lsw.Abp.AntDesignUI.sln
  4. 8
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme/Bundling/BlazorAntDesignThemeScriptContributor.cs
  5. 1
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme/Bundling/BlazorAntDesignThemeStyleContributor.cs
  6. 1
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme/Bundling/BlazorGlobalScriptContributor.cs
  7. 2
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme/Bundling/BlazorGlobalStyleContributor.cs
  8. 2
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/AbpAntDesignThemeOptions.cs
  9. 6
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/AbpAspNetCoreComponentsWebAntDesignThemeModule.cs
  10. 17
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/AbpDynamicLayoutComponentOptions.cs
  11. 50
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Bundling/AbpScripts.razor
  12. 60
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Bundling/AbpStyles.razor
  13. 54
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/AbpAspNetCoreComponentsWebAssemblyAntDesignThemeBundlingModule.cs
  14. 14
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/BlazorWebAssemblyAntDesignThemeBundles.cs
  15. 12
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/BlazorWebAssemblyAntDesignThemeScriptContributor.cs
  16. 13
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/BlazorWebAssemblyAntDesignThemeStyleContributor.cs
  17. 15
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/BlazorWebAssemblyScriptContributor.cs
  18. 14
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/BlazorWebAssemblyStandardBundles.cs
  19. 11
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/BlazorWebAssemblyStyleContributor.cs
  20. 3
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/FodyWeavers.xml
  21. 17
      modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling.csproj

12
Directory.Packages.props

@ -1,10 +1,10 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<VoloAbpPackageVersion>9.1.3</VoloAbpPackageVersion> <VoloAbpPackageVersion>9.2.1</VoloAbpPackageVersion>
<AntPackageVersion>1.4.0</AntPackageVersion> <AntPackageVersion>1.4.2</AntPackageVersion>
<MicrosoftExtensionsPackageVersion>9.0.5</MicrosoftExtensionsPackageVersion> <MicrosoftExtensionsPackageVersion>9.0.6</MicrosoftExtensionsPackageVersion>
<MicrosoftAspNetCorePackageVersion>9.0.5</MicrosoftAspNetCorePackageVersion> <MicrosoftAspNetCorePackageVersion>9.0.6</MicrosoftAspNetCorePackageVersion>
<MicrosoftEntityFrameworkCorePackageVersion>9.0.5</MicrosoftEntityFrameworkCorePackageVersion> <MicrosoftEntityFrameworkCorePackageVersion>9.0.6</MicrosoftEntityFrameworkCorePackageVersion>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup> </PropertyGroup>
<!-- Abp Framework --> <!-- Abp Framework -->
@ -104,6 +104,7 @@
<PackageVersion Include="Volo.Abp.TenantManagement.MongoDB" Version="$(VoloAbpPackageVersion)" /> <PackageVersion Include="Volo.Abp.TenantManagement.MongoDB" Version="$(VoloAbpPackageVersion)" />
<PackageVersion Include="Volo.Abp.FeatureManagement.MongoDB" Version="$(VoloAbpPackageVersion)" /> <PackageVersion Include="Volo.Abp.FeatureManagement.MongoDB" Version="$(VoloAbpPackageVersion)" />
<PackageVersion Include="Volo.Abp.OpenIddict.MongoDB" Version="$(VoloAbpPackageVersion)" /> <PackageVersion Include="Volo.Abp.OpenIddict.MongoDB" Version="$(VoloAbpPackageVersion)" />
<PackageVersion Include="Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions" Version="$(VoloAbpPackageVersion)" />
</ItemGroup> </ItemGroup>
<!-- .NET Blazor--> <!-- .NET Blazor-->
@ -137,6 +138,7 @@
</ItemGroup> </ItemGroup>
<!-- Test --> <!-- Test -->
<ItemGroup> <ItemGroup>
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.17" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" /> <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="NSubstitute" Version="5.1.0" /> <PackageVersion Include="NSubstitute" Version="5.1.0" />
<PackageVersion Include="Shouldly" Version="4.2.1" /> <PackageVersion Include="Shouldly" Version="4.2.1" />

2
common.props

@ -1,7 +1,7 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Version>0.9.7</Version> <Version>0.9.8</Version>
<PackageIconUrl>https://raw.githubusercontent.com/realliangshiwei/Lsw.Abp.AntDesignUI/main/icon.png</PackageIconUrl> <PackageIconUrl>https://raw.githubusercontent.com/realliangshiwei/Lsw.Abp.AntDesignUI/main/icon.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/realLiangshiwei/Lsw.Abp.AntDesignUI</PackageProjectUrl> <PackageProjectUrl>https://github.com/realLiangshiwei/Lsw.Abp.AntDesignUI</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageLicenseExpression>MIT</PackageLicenseExpression>

7
lsw.Abp.AntDesignUI.sln

@ -89,6 +89,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Solution Items", ".Solutio
NuGet.Config = NuGet.Config NuGet.Config = NuGet.Config
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling", "modules\AntDesignTheme\Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling\Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling.csproj", "{9FE3143F-08A8-444F-B6B9-D4533FB57674}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -215,6 +217,10 @@ Global
{2B617147-6496-44E9-8D49-B571E7EBF2D6}.Debug|Any CPU.Build.0 = Debug|Any CPU {2B617147-6496-44E9-8D49-B571E7EBF2D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2B617147-6496-44E9-8D49-B571E7EBF2D6}.Release|Any CPU.ActiveCfg = Release|Any CPU {2B617147-6496-44E9-8D49-B571E7EBF2D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B617147-6496-44E9-8D49-B571E7EBF2D6}.Release|Any CPU.Build.0 = Release|Any CPU {2B617147-6496-44E9-8D49-B571E7EBF2D6}.Release|Any CPU.Build.0 = Release|Any CPU
{9FE3143F-08A8-444F-B6B9-D4533FB57674}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9FE3143F-08A8-444F-B6B9-D4533FB57674}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9FE3143F-08A8-444F-B6B9-D4533FB57674}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9FE3143F-08A8-444F-B6B9-D4533FB57674}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -257,6 +263,7 @@ Global
{2DCCFE7C-4BC5-46F8-8493-82352CE0EE71} = {9F013513-EC16-46DF-BDEF-C9B5F0DA6C12} {2DCCFE7C-4BC5-46F8-8493-82352CE0EE71} = {9F013513-EC16-46DF-BDEF-C9B5F0DA6C12}
{90DBF0A4-253D-4E75-8221-17455B404551} = {9F013513-EC16-46DF-BDEF-C9B5F0DA6C12} {90DBF0A4-253D-4E75-8221-17455B404551} = {9F013513-EC16-46DF-BDEF-C9B5F0DA6C12}
{2B617147-6496-44E9-8D49-B571E7EBF2D6} = {1F85F600-70F9-4286-B8BD-6A124D9DC43D} {2B617147-6496-44E9-8D49-B571E7EBF2D6} = {1F85F600-70F9-4286-B8BD-6A124D9DC43D}
{9FE3143F-08A8-444F-B6B9-D4533FB57674} = {9F013513-EC16-46DF-BDEF-C9B5F0DA6C12}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {783A95E2-ACD4-4E6D-B0FC-1D05ADEB9244} SolutionGuid = {783A95E2-ACD4-4E6D-B0FC-1D05ADEB9244}

8
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme/Bundling/BlazorAntDesignThemeScriptContributor.cs

@ -1,8 +1,12 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; using System.Collections.Generic;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme.Bundling; namespace Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme.Bundling;
public class BlazorAntDesignThemeScriptContributor: BundleContributor public class BlazorAntDesignThemeScriptContributor: BundleContributor
{ {
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("/_content/AntDesign/js/ant-design-blazor.js");
}
} }

1
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme/Bundling/BlazorAntDesignThemeStyleContributor.cs

@ -7,6 +7,7 @@ public class BlazorAntDesignThemeStyleContributor: BundleContributor
{ {
public override void ConfigureBundle(BundleConfigurationContext context) public override void ConfigureBundle(BundleConfigurationContext context)
{ {
context.Files.AddIfNotContains("/_content/AntDesign/css/ant-design-blazor.css");
context.Files.AddIfNotContains("/_content/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/libs/abp/css/theme.css"); context.Files.AddIfNotContains("/_content/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/libs/abp/css/theme.css");
} }
} }

1
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme/Bundling/BlazorGlobalScriptContributor.cs

@ -9,6 +9,5 @@ public class BlazorGlobalScriptContributor : BundleContributor
{ {
context.Files.AddIfNotContains("/_framework/blazor.server.js"); context.Files.AddIfNotContains("/_framework/blazor.server.js");
context.Files.AddIfNotContains("/_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/abp.js"); context.Files.AddIfNotContains("/_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/abp.js");
context.Files.AddIfNotContains("/_content/AntDesign/js/ant-design-blazor.js");
} }
} }

2
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Server.AntDesignTheme/Bundling/BlazorGlobalStyleContributor.cs

@ -7,6 +7,6 @@ public class BlazorGlobalStyleContributor : BundleContributor
{ {
public override void ConfigureBundle(BundleConfigurationContext context) public override void ConfigureBundle(BundleConfigurationContext context)
{ {
context.Files.AddIfNotContains("/_content/AntDesign/css/ant-design-blazor.css");
} }
} }

2
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/AbpAntDesignThemeOptions.cs

@ -8,7 +8,7 @@ public class AbpAntDesignThemeOptions
public MenuOptions Menu { get; set; } public MenuOptions Menu { get; set; }
/// <summary> /// <summary>
/// 是否启用多标签页 /// Enable multiple tabs in the application.
/// </summary> /// </summary>
public bool EnableMultipleTabs { get; set; } public bool EnableMultipleTabs { get; set; }

6
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/AbpAspNetCoreComponentsWebAntDesignThemeModule.cs

@ -1,5 +1,5 @@
using Lsw.Abp.AntDesignUI; using Lsw.Abp.AntDesignUI;
using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AspNetCore.Components.Web.Security;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.UI.Navigation; using Volo.Abp.UI.Navigation;
@ -13,5 +13,9 @@ public class AbpAspNetCoreComponentsWebAntDesignThemeModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
Configure<AbpDynamicLayoutComponentOptions>(options =>
{
options.Components.Add(typeof(AbpAuthenticationState), null);
});
} }
} }

17
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/AbpDynamicLayoutComponentOptions.cs

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
namespace Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme;
public class AbpDynamicLayoutComponentOptions
{
/// <summary>
/// Used to define components that renders in the layout
/// </summary>
public Dictionary<Type, IDictionary<string,object>?> Components { get; set; }
public AbpDynamicLayoutComponentOptions()
{
Components = new Dictionary<Type, IDictionary<string, object>?>();
}
}

50
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Bundling/AbpScripts.razor

@ -1,56 +1,60 @@
@using Volo.Abp
@implements IDisposable @implements IDisposable
@inject IComponentBundleManager BundleManager @inject IComponentBundleManager BundleManager
@inject PersistentComponentState PersistentComponentState @inject PersistentComponentState ApplicationState
@if (ScriptFiles != null) @if (ScriptFiles != null)
{ {
foreach (var file in ScriptFiles) foreach (var file in ScriptFiles)
{ {
<script src="@file"></script> var src = file;
if (!AppBasePath.IsNullOrWhiteSpace())
{
src = AppBasePath.EnsureEndsWith('/') + file.RemovePreFix("/");
}
<script src="@src"></script>
} }
} }
@code { @code {
private const string PrerenderedKey = "abp_script_prerendered";
[Parameter] [Parameter]
public List<string>? WebAssemblyScriptFiles { get; set; } public List<string>? WebAssemblyScriptFiles { get; set; }
[Parameter] [Parameter]
public string? BundleName { get; set; } public string? BundleName { get; set; }
[Parameter]
public string? AppBasePath { get; set; }
private List<string>? ScriptFiles { get; set; } private List<string>? ScriptFiles { get; set; }
private PersistingComponentStateSubscription persistingSubscription; private PersistingComponentStateSubscription _persistingSubscription;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
if (BundleName == null) _persistingSubscription = ApplicationState.RegisterOnPersisting(Callback);
if (!ApplicationState.TryTakeFromJson<string>(PrerenderedKey, out _))
{ {
throw new AbpException("The BundleName parameter of the AbpScripts component can not be null!"); if (!BundleName.IsNullOrWhiteSpace())
} {
ScriptFiles = (await BundleManager.GetScriptBundleFilesAsync(BundleName!)).ToList();
persistingSubscription = PersistentComponentState.RegisterOnPersisting(PersistScriptFiles); }
if (PersistentComponentState.TryTakeFromJson<List<string>>(nameof(ScriptFiles), out var restoredStyleFiles))
{
ScriptFiles = restoredStyleFiles;
} }
else else
{ {
ScriptFiles = (await BundleManager.GetScriptBundleFilesAsync(BundleName!)).ToList(); if (OperatingSystem.IsBrowser() && WebAssemblyScriptFiles != null)
} {
ScriptFiles = WebAssemblyScriptFiles;
if (WebAssemblyScriptFiles != null) }
{
ScriptFiles?.AddRange(WebAssemblyScriptFiles);
} }
} }
private Task PersistScriptFiles() private Task Callback()
{ {
PersistentComponentState.PersistAsJson(nameof(ScriptFiles), ScriptFiles); ApplicationState.PersistAsJson(PrerenderedKey, PrerenderedKey);
return Task.CompletedTask; return Task.CompletedTask;
} }
public void Dispose() => persistingSubscription.Dispose(); public void Dispose() => _persistingSubscription.Dispose();
} }

60
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/Bundling/AbpStyles.razor

@ -1,56 +1,74 @@
@using Volo.Abp
@implements IDisposable @implements IDisposable
@inject IComponentBundleManager BundleManager @inject IComponentBundleManager BundleManager
@inject PersistentComponentState PersistentComponentState @inject PersistentComponentState ApplicationState
@if (StyleFiles != null) @if (StyleFiles != null)
{ {
foreach (var file in StyleFiles) foreach (var file in StyleFiles)
{ {
<link rel="stylesheet" href="@file" /> var href = file;
if (!AppBasePath.IsNullOrWhiteSpace())
{
href = AppBasePath.EnsureEndsWith('/') + file.RemovePreFix("/");
}
<link rel="stylesheet" href="@href" />
} }
} }
@code { @code {
private const string PrerenderedKey = "abp_style_prerendered";
[Parameter] [Parameter]
public List<string>? WebAssemblyStyleFiles { get; set; } public List<string>? WebAssemblyStyleFiles { get; set; }
[Parameter] [Parameter]
public string? BundleName { get; set; } public string? BundleName { get; set; }
[Parameter]
public string? AppBasePath { get; set; }
private List<string>? StyleFiles { get; set; } private List<string>? StyleFiles { get; set; }
private PersistingComponentStateSubscription persistingSubscription; private PersistingComponentStateSubscription _persistingSubscription;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
if (BundleName == null) _persistingSubscription = ApplicationState.RegisterOnPersisting(Callback);
if (!ApplicationState.TryTakeFromJson<List<string>>(PrerenderedKey, out var scriptFiles))
{ {
throw new AbpException("The BundleName parameter of the AbpStyles component can not be null!"); if (!BundleName.IsNullOrWhiteSpace())
} {
StyleFiles = (await BundleManager.GetStyleBundleFilesAsync(BundleName!)).ToList();
persistingSubscription = PersistentComponentState.RegisterOnPersisting(PersistStyleFiles); }
if (PersistentComponentState.TryTakeFromJson<List<string>>(nameof(StyleFiles), out var restoredStyleFiles))
{
StyleFiles = restoredStyleFiles;
} }
else else
{ {
StyleFiles = (await BundleManager.GetStyleBundleFilesAsync(BundleName!)).ToList(); StyleFiles = scriptFiles;
if (OperatingSystem.IsBrowser() && StyleFiles != null && WebAssemblyStyleFiles != null)
{
StyleFiles.AddIfNotContains(WebAssemblyStyleFiles);
}
} }
}
if (OperatingSystem.IsBrowser() && WebAssemblyStyleFiles != null) private bool _hasRemoveServerStyle = false;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (!_hasRemoveServerStyle && OperatingSystem.IsBrowser() && WebAssemblyStyleFiles != null)
{ {
StyleFiles?.AddRange(WebAssemblyStyleFiles); _hasRemoveServerStyle = true;
await Task.Delay(3000);
StyleFiles = WebAssemblyStyleFiles;
StateHasChanged();
} }
} }
private Task PersistStyleFiles() private Task Callback()
{ {
PersistentComponentState.PersistAsJson(nameof(StyleFiles), StyleFiles); ApplicationState.PersistAsJson(PrerenderedKey, StyleFiles);
return Task.CompletedTask; return Task.CompletedTask;
} }
public void Dispose() => persistingSubscription.Dispose(); public void Dispose() => _persistingSubscription.Dispose();
} }

54
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/AbpAspNetCoreComponentsWebAssemblyAntDesignThemeBundlingModule.cs

@ -0,0 +1,54 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.Modularity;
namespace Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling;
[DependsOn(
typeof(AbpAspNetCoreMvcUiBundlingAbstractionsModule)
)]
public class AbpAspNetCoreComponentsWebAssemblyAntDesignThemeBundlingModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpBundlingOptions>(options =>
{
options.GlobalAssets.Enabled = true;
options.GlobalAssets.GlobalStyleBundleName = BlazorWebAssemblyAntDesignThemeBundles.Styles.Global;
options.GlobalAssets.GlobalScriptBundleName = BlazorWebAssemblyAntDesignThemeBundles.Scripts.Global;
options
.StyleBundles
.Add(BlazorWebAssemblyStandardBundles.Styles.Global, bundle =>
{
bundle.AddContributors(typeof(BlazorWebAssemblyStyleContributor));
});
options
.ScriptBundles
.Add(BlazorWebAssemblyStandardBundles.Scripts.Global, bundle =>
{
bundle.AddContributors(typeof(BlazorWebAssemblyScriptContributor));
});
options
.StyleBundles
.Add(BlazorWebAssemblyAntDesignThemeBundles.Styles.Global, bundle =>
{
bundle
.AddBaseBundles(BlazorWebAssemblyStandardBundles.Styles.Global)
.AddContributors(typeof(BlazorWebAssemblyAntDesignThemeStyleContributor));
});
options
.ScriptBundles
.Add(BlazorWebAssemblyAntDesignThemeBundles.Scripts.Global, bundle =>
{
bundle
.AddBaseBundles(BlazorWebAssemblyStandardBundles.Scripts.Global)
.AddContributors(typeof(BlazorWebAssemblyAntDesignThemeScriptContributor));
});
options.MinificationIgnoredFiles.Add("_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js");
});
}
}

14
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/BlazorWebAssemblyAntDesignThemeBundles.cs

@ -0,0 +1,14 @@
namespace Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling;
public class BlazorWebAssemblyAntDesignThemeBundles
{
public static class Styles
{
public static string Global = "BlazorWebAssembly.AntDesignTheme.Global";
}
public static class Scripts
{
public static string Global = "BlazorWebAssembly.AntDesignTheme.Global";
}
}

12
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/BlazorWebAssemblyAntDesignThemeScriptContributor.cs

@ -0,0 +1,12 @@
using System.Collections.Generic;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling;
public class BlazorWebAssemblyAntDesignThemeScriptContributor: BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("_content/AntDesign/js/ant-design-blazor.js");
}
}

13
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/BlazorWebAssemblyAntDesignThemeStyleContributor.cs

@ -0,0 +1,13 @@
using System.Collections.Generic;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling;
public class BlazorWebAssemblyAntDesignThemeStyleContributor: BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("_content/AntDesign/css/ant-design-blazor.css");
context.Files.AddIfNotContains("_content/Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme/libs/abp/css/theme.css");
}
}

15
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/BlazorWebAssemblyScriptContributor.cs

@ -0,0 +1,15 @@
using System.Collections.Generic;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling;
public class BlazorWebAssemblyScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/abp.js");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/lang-utils.js");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/authentication-state-listener.js");
}
}

14
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/BlazorWebAssemblyStandardBundles.cs

@ -0,0 +1,14 @@
namespace Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling;
public class BlazorWebAssemblyStandardBundles
{
public static class Styles
{
public static string Global = "BlazorWebAssembly.Global";
}
public static class Scripts
{
public static string Global = "BlazorWebAssembly.Global";
}
}

11
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/BlazorWebAssemblyStyleContributor.cs

@ -0,0 +1,11 @@
using System.Collections.Generic;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling;
public class BlazorWebAssemblyStyleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
}
}

3
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
</Weavers>

17
modules/AntDesignTheme/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling/Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling.csproj

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\..\common.props" />
<Import Project="..\..\..\configureawait.props" />
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions"/>
</ItemGroup>
</Project>
Loading…
Cancel
Save