ContentCdnifier 1.2.8
dotnet add package ContentCdnifier --version 1.2.8
NuGet\Install-Package ContentCdnifier -Version 1.2.8
<PackageReference Include="ContentCdnifier" Version="1.2.8" />
paket add ContentCdnifier --version 1.2.8
#r "nuget: ContentCdnifier, 1.2.8"
// Install ContentCdnifier as a Cake Addin #addin nuget:?package=ContentCdnifier&version=1.2.8 // Install ContentCdnifier as a Cake Tool #tool nuget:?package=ContentCdnifier&version=1.2.8
ContentCdnifier
A .NET library that provides ASP.NET core middleware to optionally rewrite relative local static file links to an external CDN.
See the changelog for changes.
Overview
Hosting static content from the wwwroot folder in an ASP.NET Core web application is convenient, but can have an impact on CPU usage and bandwidth used when hosted in an Azure App Service environment. The ContentCdnifier package enables one to easily offload the static files, allowing the hosting to occur on a separate web host like your favorite CDN provider.
The configuration settings allow for the functionality to be enabled only in certain environments. Therefore, when developing locally, the local wwwroot folder can be used, but when hosted in a production environment an alternative location can be specified.
Getting Started
The ContentCdnifier middleware is easily initialized and added to the ASP.NET pipeline during startup.
app.UseContentCdnifier();
During initialization, ContentCdnifier can be configured through the appsettings.json.
{
"ContentCdnifier": {
"CdnHost": "https://example.azureedge.com/"
}
}
Tags/Attributes Targets
A standard set of media tags and corresponding attributes are configured to be modified. The tags and their target tags can be modified during startup.
app.UseContentCdnifier(x =>
{
x.TagAttributeMappings["script"] = ["src", "data-src"];
);
Excluding Tags
Specific HTML tags can be excluded from modifications by setting the data-cdnify
attribute to false.
<img src='image.jpg' data-content-cdnify='false' />
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- HtmlAgilityPack (>= 1.11.60)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.8 | 95 | 4/22/2024 |
1.2.8-beta | 65 | 4/22/2024 |
1.1.6 | 87 | 4/17/2024 |
1.1.6-beta | 66 | 4/17/2024 |
1.0.3 | 115 | 4/1/2024 |
1.0.3-beta | 72 | 4/1/2024 |