AppScriptTagHelper Class
Definition
- Namespace
- Cuemon.AspNetCore.Razor.TagHelpers
- Assemblies
- Cuemon.AspNetCore.Razor.TagHelpers.dll
Provides an implementation targeting <script> elements that supports ICacheBusting versioning of a static script placed on a location outside (but tied to) your application. This class cannot be inherited.
[HtmlTargetElement("app-script")]
public sealed class AppScriptTagHelper : ScriptTagHelper<AppTagHelperOptions>, ITagHelper, ITagHelperComponent, IConfigurable<AppTagHelperOptions>
- Inheritance
-
AppScriptTagHelper
- Implements
- Inherited Members
Examples
The following example demonstrates how to create with application-scoped options.
using System;
using Cuemon.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Options;
namespace MyApp.Examples;
public static class AppScriptTagHelperExample
{
public static void Demonstrate()
{
var options = Options.Create(new AppTagHelperOptions
{
Scheme = ProtocolUriScheme.Relative,
BaseUrl = "static.cuemon.net"
});
var tagHelper = new AppScriptTagHelper(options)
{
Src = "js/app.js",
Defer = true
};
Console.WriteLine(string.Concat(tagHelper.Options.GetFormattedBaseUrl(), tagHelper.Src));
}
}
Constructors
| Name | Description |
|---|---|
| AppScriptTagHelper(IOptions<AppTagHelperOptions>, ICacheBusting) | Initializes a new instance of the AppScriptTagHelper class. |
See Also
ScriptTagHelper<TOptions>