[backend/razor] Add CSS/JS versioning to razor pages & blazor ssr
This commit is contained in:
parent
20f2168881
commit
4a5f575619
11 changed files with 56 additions and 24 deletions
|
@ -1,5 +1,6 @@
|
||||||
@using Microsoft.AspNetCore.Components.Web
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
|
@using Iceshrimp.Backend.Components.Helpers
|
||||||
<HeadContent>
|
<HeadContent>
|
||||||
<link rel="stylesheet" href="/css/admin.css"/>
|
<VersionedLink rel="stylesheet" href="/css/admin.css"/>
|
||||||
<script src="/js/admin.js"></script>
|
<VersionedScript src="/js/admin.js"/>
|
||||||
</HeadContent>
|
</HeadContent>
|
15
Iceshrimp.Backend/Components/Helpers/VersionedLink.razor
Normal file
15
Iceshrimp.Backend/Components/Helpers/VersionedLink.razor
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
@using Microsoft.AspNetCore.Mvc.ViewFeatures
|
||||||
|
<link @attributes="AdditionalAttributes" href="@VersionedHref"/>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Inject] public required IFileVersionProvider FileVersionProvider { get; set; }
|
||||||
|
|
||||||
|
@* ReSharper disable InconsistentNaming *@
|
||||||
|
[Parameter, EditorRequired] public required string href { get; set; }
|
||||||
|
@* ReSharper restore InconsistentNaming *@
|
||||||
|
|
||||||
|
[Parameter(CaptureUnmatchedValues = true)]
|
||||||
|
public IDictionary<string, object>? AdditionalAttributes { get; set; }
|
||||||
|
|
||||||
|
private string VersionedHref => FileVersionProvider.AddFileVersionToPath("", href);
|
||||||
|
}
|
15
Iceshrimp.Backend/Components/Helpers/VersionedScript.razor
Normal file
15
Iceshrimp.Backend/Components/Helpers/VersionedScript.razor
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
@using Microsoft.AspNetCore.Mvc.ViewFeatures
|
||||||
|
<script src="@VersionedSrc" @attributes="AdditionalAttributes"></script>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Inject] public required IFileVersionProvider FileVersionProvider { get; set; }
|
||||||
|
|
||||||
|
@* ReSharper disable InconsistentNaming *@
|
||||||
|
[Parameter, EditorRequired] public required string src { get; set; }
|
||||||
|
@* ReSharper restore InconsistentNaming *@
|
||||||
|
|
||||||
|
[Parameter(CaptureUnmatchedValues = true)]
|
||||||
|
public IDictionary<string, object>? AdditionalAttributes { get; set; }
|
||||||
|
|
||||||
|
private string VersionedSrc => FileVersionProvider.AddFileVersionToPath("", src);
|
||||||
|
}
|
|
@ -101,7 +101,7 @@ else
|
||||||
<meta name="og:image" content="@previewImageUrl">
|
<meta name="og:image" content="@previewImageUrl">
|
||||||
<meta name="og:description" content="@description">
|
<meta name="og:description" content="@description">
|
||||||
|
|
||||||
<link rel="stylesheet" href="/css/public-preview.css"/>
|
<VersionedLink rel="stylesheet" href="/css/public-preview.css"/>
|
||||||
</HeadContent>
|
</HeadContent>
|
||||||
|
|
||||||
if (!ShowRemoteReplies)
|
if (!ShowRemoteReplies)
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@section head {
|
@section head {
|
||||||
<link rel="stylesheet" href="~/css/queue.css"/>
|
<link rel="stylesheet" href="~/css/queue.css" asp-append-version="true"/>
|
||||||
}
|
}
|
||||||
|
|
||||||
@section scripts {
|
@section scripts {
|
||||||
<script src="~/js/queue.js"></script>
|
<script src="~/js/queue.js" asp-append-version="true"></script>
|
||||||
@if (Model.Queue == null)
|
@if (Model.Queue == null)
|
||||||
{
|
{
|
||||||
<script src="~/js/queue-index.js"></script>
|
<script src="~/js/queue-index.js" asp-append-version="true"></script>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
<button role="link" data-target="/queue" onclick="navigate(event)">overview</button>
|
<button role="link" data-target="/queue" onclick="navigate(event)">overview</button>
|
||||||
@foreach (var queue in QueueSvc.QueueNames)
|
@foreach (var queue in QueueSvc.QueueNames)
|
||||||
{
|
{
|
||||||
|
//asd
|
||||||
<button role="link" data-target="/queue/@queue" onclick="navigate(event)">@queue</button>
|
<button role="link" data-target="/queue/@queue" onclick="navigate(event)">@queue</button>
|
||||||
}
|
}
|
||||||
<br/>
|
<br/>
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@section head {
|
@section head {
|
||||||
<link rel="stylesheet" href="~/css/queue.css"/>
|
<link rel="stylesheet" href="~/css/queue.css" asp-append-version="true"/>
|
||||||
}
|
}
|
||||||
|
|
||||||
@section scripts {
|
@section scripts {
|
||||||
<script src="~/js/queue.js"></script>
|
<script src="~/js/queue.js" asp-append-version="true"></script>
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1>Queue Dashboard</h1>
|
<h1>Queue Dashboard</h1>
|
||||||
|
|
|
@ -15,10 +15,10 @@
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<title>@("Error - Iceshrimp.NET")</title>
|
<title>@("Error - Iceshrimp.NET")</title>
|
||||||
@* ReSharper disable once Html.PathError *@
|
@* ReSharper disable once Html.PathError *@
|
||||||
<link rel="stylesheet" href="~/Iceshrimp.Backend.styles.css"/>
|
<link rel="stylesheet" href="~/Iceshrimp.Backend.styles.css" asp-append-version="true"/>
|
||||||
<link rel="stylesheet" href="~/css/default.css"/>
|
<link rel="stylesheet" href="~/css/default.css" asp-append-version="true"/>
|
||||||
@* ReSharper disable once Html.PathError *@
|
@* ReSharper disable once Html.PathError *@
|
||||||
<link rel="icon" type="image/png" href="~/favicon.png"/>
|
<link rel="icon" type="image/png" href="~/favicon.png" asp-append-version="true"/>
|
||||||
<style>
|
<style>
|
||||||
.float-right {
|
.float-right {
|
||||||
float: right;
|
float: right;
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
|
||||||
<title>Iceshrimp.Frontend</title>
|
<title>Iceshrimp.Frontend</title>
|
||||||
<base href="/"/>
|
<base href="/"/>
|
||||||
<link rel="stylesheet" href="~/css/app.css"/>
|
<link rel="stylesheet" href="~/css/app.css" asp-append-version="true"/>
|
||||||
<link rel="stylesheet" href="~/_content/Iceshrimp.Assets.PhosphorIcons/css/ph-regular.css"/>
|
<link rel="stylesheet" href="~/_content/Iceshrimp.Assets.PhosphorIcons/css/ph-regular.css" asp-append-version="true"/>
|
||||||
<link rel="stylesheet" href="~/_content/Iceshrimp.Assets.PhosphorIcons/css/ph-fill.css"/>
|
<link rel="stylesheet" href="~/_content/Iceshrimp.Assets.PhosphorIcons/css/ph-fill.css" asp-append-version="true"/>
|
||||||
<link rel="icon" type="image/png" href="~/favicon.png"/>
|
<link rel="icon" type="image/png" href="~/favicon.png" asp-append-version="true"/>
|
||||||
<link href="~/Iceshrimp.Frontend.styles.css" rel="stylesheet"/>
|
<link rel="stylesheet" href="~/Iceshrimp.Frontend.styles.css" asp-append-version="true"/>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
<a class="dismiss">🗙</a>
|
<a class="dismiss">🗙</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="~/_framework/blazor.webassembly.js"></script>
|
<script src="~/_framework/blazor.webassembly.js" asp-append-version="true"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
<!--suppress HtmlRequiredTitleElement, Justification: HeadOutlet -->
|
<!--suppress HtmlRequiredTitleElement, Justification: HeadOutlet -->
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<link rel="stylesheet" href="/Iceshrimp.Backend.styles.css"/>
|
<VersionedLink rel="stylesheet" href="/Iceshrimp.Backend.styles.css"/>
|
||||||
<link rel="stylesheet" href="/css/default.css"/>
|
<VersionedLink rel="stylesheet" href="/css/default.css"/>
|
||||||
<link rel="icon" type="image/png" href="/favicon.png"/>
|
<VersionedLink rel="icon" type="image/png" href="/favicon.png"/>
|
||||||
<HeadOutlet/>
|
<HeadOutlet/>
|
||||||
<PageTitle>@(_instanceName ?? "Iceshrimp.NET")</PageTitle>
|
<PageTitle>@(_instanceName ?? "Iceshrimp.NET")</PageTitle>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<title>@(ViewData["title"] ?? "Iceshrimp.NET")</title>
|
<title>@(ViewData["title"] ?? "Iceshrimp.NET")</title>
|
||||||
@* ReSharper disable once Html.PathError *@
|
@* ReSharper disable once Html.PathError *@
|
||||||
<link rel="stylesheet" href="~/Iceshrimp.Backend.styles.css"/>
|
<link rel="stylesheet" href="~/Iceshrimp.Backend.styles.css" asp-append-version="true"/>
|
||||||
<link rel="stylesheet" href="~/css/default.css"/>
|
<link rel="stylesheet" href="~/css/default.css" asp-append-version="true"/>
|
||||||
@* ReSharper disable once Html.PathError *@
|
@* ReSharper disable once Html.PathError *@
|
||||||
<link rel="icon" type="image/png" href="~/favicon.png"/>
|
<link rel="icon" type="image/png" href="~/favicon.png" asp-append-version="true"/>
|
||||||
@await RenderSectionAsync("styles", false)
|
@await RenderSectionAsync("styles", false)
|
||||||
@await RenderSectionAsync("head", false)
|
@await RenderSectionAsync("head", false)
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -36,6 +36,6 @@ else
|
||||||
<meta name="og:description" content="@bio">
|
<meta name="og:description" content="@bio">
|
||||||
}
|
}
|
||||||
<meta name="og:image" content="@_user.AvatarUrl">
|
<meta name="og:image" content="@_user.AvatarUrl">
|
||||||
<link rel="stylesheet" href="/css/public-preview.css"/>
|
<VersionedLink rel="stylesheet" href="/css/public-preview.css"/>
|
||||||
</HeadContent>
|
</HeadContent>
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue