Browse Source

feat: add AppBasePath parameter to script and style bundling components

pull/22514/head
maliming 1 year ago
parent
commit
c8b39e45c4
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 10
      framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Bundling/AbpScripts.razor
  2. 10
      framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Bundling/AbpStyles.razor

10
framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Bundling/AbpScripts.razor

@ -5,7 +5,12 @@
{
foreach (var file in ScriptFiles)
{
<script src="@file"></script>
var src = file;
if (!AppBasePath.IsNullOrWhiteSpace())
{
src = AppBasePath.EnsureEndsWith('/') + file.RemovePreFix("/");
}
<script src="@src"></script>
}
}
@ -19,6 +24,9 @@
[Parameter]
public string? BundleName { get; set; }
[Parameter]
public string? AppBasePath { get; set; }
private List<string>? ScriptFiles { get; set; }
private PersistingComponentStateSubscription _persistingSubscription;

10
framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Bundling/AbpStyles.razor

@ -5,7 +5,12 @@
{
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" />
}
}
@ -19,6 +24,9 @@
[Parameter]
public string? BundleName { get; set; }
[Parameter]
public string? AppBasePath { get; set; }
private List<string>? StyleFiles { get; set; }
private PersistingComponentStateSubscription _persistingSubscription;

Loading…
Cancel
Save