Browse Source
Add `_framework/blazor.web.js` to `App.razor`.
pull/18876/head
maliming
2 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
17 changed files with
139 additions and
82 deletions
-
docs/en/Migration-Guides/Abp-8-2-Blazor-Web-App.md
-
framework/src/Volo.Abp.AspNetCore.Components.Server.Theming/Bundling/AbpScripts.razor
-
framework/src/Volo.Abp.AspNetCore.Components.Server.Theming/Bundling/AbpStyles.razor
-
framework/src/Volo.Abp.AspNetCore.Components.Server.Theming/Bundling/BlazorGlobalScriptContributor.cs
-
framework/src/Volo.Abp.AspNetCore.Components.Server.Theming/Bundling/BlazorServerComponentBundleManager.cs
-
framework/src/Volo.Abp.AspNetCore.Components.Server/Volo/Abp/AspNetCore/Components/Server/AbpAspNetCoreComponentsServerModule.cs
-
framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Bundling/AbpScripts.razor
-
framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Bundling/AbpStyles.razor
-
framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Bundling/IComponentBundleManager.cs
-
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/WebAssemblyComponentBundleManager.cs
-
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/Components/App.razor
-
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/Components/App.razor
-
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/Components/App.razor
-
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/Components/App.razor
-
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered/Components/App.razor
-
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/Components/App.razor
-
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Components/App.razor
|
|
|
@ -1,26 +0,0 @@ |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|
|
|
@inject IBundleManager BundleManager |
|
|
|
|
|
|
|
@if (ScriptBundleFiles != null) |
|
|
|
{ |
|
|
|
foreach (var bundleFile in ScriptBundleFiles) |
|
|
|
{ |
|
|
|
<script src="@bundleFile.FileName"></script> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@code { |
|
|
|
private IReadOnlyList<BundleFile>? ScriptBundleFiles { get; set; } |
|
|
|
|
|
|
|
[Parameter] |
|
|
|
public string? BundleName { get; set; } |
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync() |
|
|
|
{ |
|
|
|
if (BundleName == null) |
|
|
|
{ |
|
|
|
throw new AbpException("The BundleName parameter of the AbpScripts component can not be null!"); |
|
|
|
} |
|
|
|
ScriptBundleFiles = await BundleManager.GetScriptBundleFilesAsync(BundleName!); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1,26 +0,0 @@ |
|
|
|
@using Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|
|
|
@inject IBundleManager BundleManager |
|
|
|
|
|
|
|
@if (StyleBundleFiles != null) |
|
|
|
{ |
|
|
|
foreach (var bundleFile in StyleBundleFiles) |
|
|
|
{ |
|
|
|
<link rel="stylesheet" href="@bundleFile.FileName" /> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@code { |
|
|
|
private IReadOnlyList<BundleFile>? StyleBundleFiles { get; set; } |
|
|
|
|
|
|
|
[Parameter] |
|
|
|
public string? BundleName { get; set; } |
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync() |
|
|
|
{ |
|
|
|
if (BundleName == null) |
|
|
|
{ |
|
|
|
throw new AbpException("The BundleName parameter of the AbpStyles component can not be null!"); |
|
|
|
} |
|
|
|
StyleBundleFiles = await BundleManager.GetStyleBundleFilesAsync(BundleName!); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -10,9 +10,10 @@ public class BlazorGlobalScriptContributor : BundleContributor |
|
|
|
public override void ConfigureBundle(BundleConfigurationContext context) |
|
|
|
{ |
|
|
|
var options = context.ServiceProvider.GetRequiredService<IOptions<AbpAspNetCoreComponentsWebOptions>>().Value; |
|
|
|
context.Files.AddIfNotContains(options.IsBlazorWebApp |
|
|
|
? "/_framework/blazor.web.js" |
|
|
|
: "/_framework/blazor.server.js"); |
|
|
|
if (!options.IsBlazorWebApp) |
|
|
|
{ |
|
|
|
context.Files.AddIfNotContains("/_framework/blazor.server.js"); |
|
|
|
} |
|
|
|
context.Files.AddIfNotContains("/_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/abp.js"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -0,0 +1,28 @@ |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Volo.Abp.AspNetCore.Components.Web.Theming.Bundling; |
|
|
|
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
|
|
|
|
namespace Volo.Abp.AspNetCore.Components.Server.Theming.Bundling; |
|
|
|
|
|
|
|
public class BlazorServerComponentBundleManager : IComponentBundleManager, ITransientDependency |
|
|
|
{ |
|
|
|
protected IBundleManager BundleManager { get; } |
|
|
|
|
|
|
|
public BlazorServerComponentBundleManager(IBundleManager bundleManager) |
|
|
|
{ |
|
|
|
BundleManager = bundleManager; |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task<IReadOnlyList<string>> GetStyleBundleFilesAsync(string bundleName) |
|
|
|
{ |
|
|
|
return (await BundleManager.GetStyleBundleFilesAsync(bundleName)).Select(f => f.FileName).ToList(); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task<IReadOnlyList<string>> GetScriptBundleFilesAsync(string bundleName) |
|
|
|
{ |
|
|
|
return (await BundleManager.GetScriptBundleFilesAsync(bundleName)).Select(f => f.FileName).ToList(); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -79,6 +79,7 @@ public class AbpAspNetCoreComponentsServerModule : AbpModule |
|
|
|
context.GetEnvironment().WebRootFileProvider = |
|
|
|
new CompositeFileProvider( |
|
|
|
new ManifestEmbeddedFileProvider(typeof(IServerSideBlazorBuilder).Assembly), |
|
|
|
new ManifestEmbeddedFileProvider(typeof(RazorComponentsEndpointRouteBuilderExtensions).Assembly), |
|
|
|
context.GetEnvironment().WebRootFileProvider |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
@ -0,0 +1,26 @@ |
|
|
|
@using Volo.Abp |
|
|
|
@inject IComponentBundleManager BundleManager |
|
|
|
|
|
|
|
@if (ScriptFiles != null) |
|
|
|
{ |
|
|
|
foreach (var file in ScriptFiles) |
|
|
|
{ |
|
|
|
<script src="@file"></script> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@code { |
|
|
|
private IReadOnlyList<string>? ScriptFiles { get; set; } |
|
|
|
|
|
|
|
[Parameter] |
|
|
|
public string? BundleName { get; set; } |
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync() |
|
|
|
{ |
|
|
|
if (BundleName == null) |
|
|
|
{ |
|
|
|
throw new AbpException("The BundleName parameter of the AbpScripts component can not be null!"); |
|
|
|
} |
|
|
|
ScriptFiles = await BundleManager.GetScriptBundleFilesAsync(BundleName!); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -0,0 +1,27 @@ |
|
|
|
@using Volo.Abp |
|
|
|
@inject IComponentBundleManager BundleManager |
|
|
|
|
|
|
|
@if (StyleFiles != null) |
|
|
|
{ |
|
|
|
foreach (var file in StyleFiles) |
|
|
|
{ |
|
|
|
<link rel="stylesheet" href="@file"/> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@code { |
|
|
|
private IReadOnlyList<string>? StyleFiles { get; set; } |
|
|
|
|
|
|
|
[Parameter] |
|
|
|
public string? BundleName { get; set; } |
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync() |
|
|
|
{ |
|
|
|
if (BundleName == null) |
|
|
|
{ |
|
|
|
throw new AbpException("The BundleName parameter of the AbpStyles component can not be null!"); |
|
|
|
} |
|
|
|
|
|
|
|
StyleFiles = await BundleManager.GetStyleBundleFilesAsync(BundleName!); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -0,0 +1,11 @@ |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Bundling; |
|
|
|
|
|
|
|
public interface IComponentBundleManager |
|
|
|
{ |
|
|
|
Task<IReadOnlyList<string>> GetStyleBundleFilesAsync(string bundleName); |
|
|
|
|
|
|
|
Task<IReadOnlyList<string>> GetScriptBundleFilesAsync(string bundleName); |
|
|
|
} |
|
|
|
@ -0,0 +1,19 @@ |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Volo.Abp.AspNetCore.Components.Web.Theming.Bundling; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
|
|
|
|
namespace Volo.Abp.AspNetCore.Components.WebAssembly.Theming; |
|
|
|
|
|
|
|
public class WebAssemblyComponentBundleManager : IComponentBundleManager, ITransientDependency |
|
|
|
{ |
|
|
|
public virtual Task<IReadOnlyList<string>> GetStyleBundleFilesAsync(string bundleName) |
|
|
|
{ |
|
|
|
return Task.FromResult<IReadOnlyList<string>>(new List<string> {"global.css", "main.css"}); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual Task<IReadOnlyList<string>> GetScriptBundleFilesAsync(string bundleName) |
|
|
|
{ |
|
|
|
return Task.FromResult<IReadOnlyList<string>>(new List<string> {"global.js"}); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1,8 +1,8 @@ |
|
|
|
@using Volo.Abp.Localization |
|
|
|
@using System.Globalization |
|
|
|
@using Microsoft.Extensions.Hosting |
|
|
|
@using Volo.Abp.AspNetCore.Components.Server.Theming.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Components.Web.Theming.Bundling |
|
|
|
@inject IHostEnvironment Env |
|
|
|
@{ |
|
|
|
var rtl = CultureHelper.IsRtl ? "rtl" : string.Empty; |
|
|
|
@ -28,6 +28,8 @@ |
|
|
|
|
|
|
|
<AbpScripts BundleName="@BlazorLeptonXLiteThemeBundles.Scripts.Global" /> |
|
|
|
|
|
|
|
<script src="_framework/blazor.web.js"></script> |
|
|
|
|
|
|
|
<div id="blazor-error-ui"> |
|
|
|
@if (Env.IsDevelopment()) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -1,8 +1,8 @@ |
|
|
|
@using Volo.Abp.Localization |
|
|
|
@using System.Globalization |
|
|
|
@using Microsoft.Extensions.Hosting |
|
|
|
@using Volo.Abp.AspNetCore.Components.Server.Theming.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Components.Web.Theming.Bundling |
|
|
|
@inject IHostEnvironment Env |
|
|
|
@{ |
|
|
|
var rtl = CultureHelper.IsRtl ? "rtl" : string.Empty; |
|
|
|
@ -28,6 +28,8 @@ |
|
|
|
|
|
|
|
<AbpScripts BundleName="@BlazorLeptonXLiteThemeBundles.Scripts.Global" /> |
|
|
|
|
|
|
|
<script src="_framework/blazor.web.js"></script> |
|
|
|
|
|
|
|
<div id="blazor-error-ui"> |
|
|
|
@if (Env.IsDevelopment()) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -1,8 +1,8 @@ |
|
|
|
@using Volo.Abp.Localization |
|
|
|
@using System.Globalization |
|
|
|
@using Microsoft.Extensions.Hosting |
|
|
|
@using Volo.Abp.AspNetCore.Components.Server.Theming.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Components.Web.Theming.Bundling |
|
|
|
@inject IHostEnvironment Env |
|
|
|
@{ |
|
|
|
var rtl = CultureHelper.IsRtl ? "rtl" : string.Empty; |
|
|
|
@ -28,6 +28,8 @@ |
|
|
|
|
|
|
|
<AbpScripts BundleName="@BlazorLeptonXLiteThemeBundles.Scripts.Global" /> |
|
|
|
|
|
|
|
<script src="_framework/blazor.web.js"></script> |
|
|
|
|
|
|
|
<div id="blazor-error-ui"> |
|
|
|
@if (Env.IsDevelopment()) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -1,8 +1,8 @@ |
|
|
|
@using Volo.Abp.Localization |
|
|
|
@using System.Globalization |
|
|
|
@using Microsoft.Extensions.Hosting |
|
|
|
@using Volo.Abp.AspNetCore.Components.Server.Theming.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Components.Web.Theming.Bundling |
|
|
|
@inject IHostEnvironment Env |
|
|
|
@{ |
|
|
|
var rtl = CultureHelper.IsRtl ? "rtl" : string.Empty; |
|
|
|
@ -28,6 +28,8 @@ |
|
|
|
|
|
|
|
<AbpScripts BundleName="@BlazorLeptonXLiteThemeBundles.Scripts.Global" /> |
|
|
|
|
|
|
|
<script src="_framework/blazor.web.js"></script> |
|
|
|
|
|
|
|
<div id="blazor-error-ui"> |
|
|
|
@if (Env.IsDevelopment()) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -3,8 +3,8 @@ |
|
|
|
@using Microsoft.AspNetCore.Authentication |
|
|
|
@using Microsoft.AspNetCore.Http |
|
|
|
@using Microsoft.Extensions.Hosting |
|
|
|
@using Volo.Abp.AspNetCore.Components.Server.Theming.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Components.Web.Theming.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Components.WebAssembly.WebApp |
|
|
|
@inject IHostEnvironment Env |
|
|
|
@{ |
|
|
|
@ -20,12 +20,7 @@ |
|
|
|
<title>MyCompanyName.MyProjectName.Blazor.Server</title> |
|
|
|
<base href="/" /> |
|
|
|
|
|
|
|
<!--ABP:Styles--> |
|
|
|
<link href="global.css?_v=638417120185267609" rel="stylesheet"/> |
|
|
|
<link href="main.css" rel="stylesheet"/> |
|
|
|
<!--/ABP:Styles--> |
|
|
|
|
|
|
|
<AbpStyles BundleName="@BlazorLeptonXLiteThemeBundles.Styles.Global" /> |
|
|
|
<AbpStyles BundleName="@BlazorLeptonXLiteThemeBundles.Styles.Global" @rendermode="InteractiveAuto" /> |
|
|
|
|
|
|
|
<HeadOutlet @rendermode="InteractiveAuto" /> |
|
|
|
|
|
|
|
@ -34,11 +29,9 @@ |
|
|
|
|
|
|
|
<Routes @rendermode="InteractiveAuto" /> |
|
|
|
|
|
|
|
<AbpScripts BundleName="@BlazorLeptonXLiteThemeBundles.Scripts.Global" /> |
|
|
|
<AbpScripts BundleName="@BlazorLeptonXLiteThemeBundles.Scripts.Global" @rendermode="InteractiveAuto" /> |
|
|
|
|
|
|
|
<!--ABP:Scripts--> |
|
|
|
<script src="global.js?_v=638417120186975895"></script> |
|
|
|
<!--/ABP:Scripts--> |
|
|
|
<script src="_framework/blazor.web.js"></script> |
|
|
|
|
|
|
|
<div id="blazor-error-ui"> |
|
|
|
@if (Env.IsDevelopment()) |
|
|
|
|
|
|
|
@ -2,7 +2,7 @@ |
|
|
|
@using System.Globalization |
|
|
|
@using Microsoft.Extensions.Hosting |
|
|
|
@using Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Components.Server.Theming.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Components.Web.Theming.Bundling |
|
|
|
@inject IHostEnvironment Env |
|
|
|
@{ |
|
|
|
var rtl = CultureHelper.IsRtl ? "rtl" : string.Empty; |
|
|
|
@ -17,12 +17,7 @@ |
|
|
|
<title>MyCompanyName.MyProjectName.Blazor.Server</title> |
|
|
|
<base href="/" /> |
|
|
|
|
|
|
|
<!--ABP:Styles--> |
|
|
|
<link href="global.css?_v=638417120185267609" rel="stylesheet"/> |
|
|
|
<link href="main.css" rel="stylesheet"/> |
|
|
|
<!--/ABP:Styles--> |
|
|
|
|
|
|
|
<AbpStyles BundleName="@BlazorLeptonXLiteThemeBundles.Styles.Global" /> |
|
|
|
<AbpStyles BundleName="@BlazorLeptonXLiteThemeBundles.Styles.Global" @rendermode="InteractiveAuto" /> |
|
|
|
|
|
|
|
<HeadOutlet @rendermode="InteractiveAuto" /> |
|
|
|
|
|
|
|
@ -31,11 +26,9 @@ |
|
|
|
|
|
|
|
<Routes @rendermode="InteractiveAuto" /> |
|
|
|
|
|
|
|
<AbpScripts BundleName="@BlazorLeptonXLiteThemeBundles.Scripts.Global" /> |
|
|
|
<AbpScripts BundleName="@BlazorLeptonXLiteThemeBundles.Scripts.Global" @rendermode="InteractiveAuto" /> |
|
|
|
|
|
|
|
<!--ABP:Scripts--> |
|
|
|
<script src="global.js?_v=638417120186975895"></script> |
|
|
|
<!--/ABP:Scripts--> |
|
|
|
<script src="_framework/blazor.web.js"></script> |
|
|
|
|
|
|
|
<div id="blazor-error-ui"> |
|
|
|
@if (Env.IsDevelopment()) |
|
|
|
|
|
|
|
@ -1,8 +1,8 @@ |
|
|
|
@using Volo.Abp.Localization |
|
|
|
@using System.Globalization |
|
|
|
@using Microsoft.Extensions.Hosting |
|
|
|
@using Volo.Abp.AspNetCore.Components.Server.Theming.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Components.Server.BasicTheme.Bundling |
|
|
|
@using Volo.Abp.AspNetCore.Components.Web.Theming.Bundling |
|
|
|
@inject IHostEnvironment Env |
|
|
|
@{ |
|
|
|
var rtl = CultureHelper.IsRtl ? "rtl" : string.Empty; |
|
|
|
@ -28,6 +28,8 @@ |
|
|
|
|
|
|
|
<AbpScripts BundleName="@BlazorBasicThemeBundles.Scripts.Global" /> |
|
|
|
|
|
|
|
<script src="_framework/blazor.web.js"></script> |
|
|
|
|
|
|
|
<div id="blazor-error-ui"> |
|
|
|
@if (Env.IsDevelopment()) |
|
|
|
{ |
|
|
|
|