ContentCdnifier 1.2.8

dotnet add package ContentCdnifier --version 1.2.8
NuGet\Install-Package ContentCdnifier -Version 1.2.8
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ContentCdnifier" Version="1.2.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ContentCdnifier --version 1.2.8
#r "nuget: ContentCdnifier, 1.2.8"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 53 4/22/2024
1.2.8-beta 41 4/22/2024
1.1.6 75 4/17/2024
1.1.6-beta 61 4/17/2024
1.0.3 99 4/1/2024
1.0.3-beta 66 4/1/2024