Excubo.Blazor.ScriptInjection 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Excubo.Blazor.ScriptInjection --version 1.0.2                
NuGet\Install-Package Excubo.Blazor.ScriptInjection -Version 1.0.2                
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="Excubo.Blazor.ScriptInjection" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Excubo.Blazor.ScriptInjection --version 1.0.2                
#r "nuget: Excubo.Blazor.ScriptInjection, 1.0.2"                
#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 Excubo.Blazor.ScriptInjection as a Cake Addin
#addin nuget:?package=Excubo.Blazor.ScriptInjection&version=1.0.2

// Install Excubo.Blazor.ScriptInjection as a Cake Tool
#tool nuget:?package=Excubo.Blazor.ScriptInjection&version=1.0.2                

This library brings the script tag to Blazor. Since components can occur any number of times, the usage of script tags in components is usually frowned upon. The Script component in Excubo.Blazor.ScriptInjection is different, as it makes sure that the source file is only put into the page's body once.

This can be used to lazily load javascript sources for any component that requires javascript. As a component library author, you can use this to relieve your users of the burden of adding script tags to their pages' <head>. Simply add <Script Src="_content/My.Library/code.js"> to any component in your library that requires that file. Excubo.Blazor.ScriptInjection makes sure the script gets loaded once and only once, regardless of how many components you have, and regardless of how many components your users use.

Usage

1. Add ScriptInjection to your services
    //...
    //using Excubo.Blazor.ScriptInjection;
    services.AddScriptInjection();
    //...
2. Use the Script component
<h3>My component requiring some js</h3>
<Script Src="path/to/code.js" Async="true" Defer="false" />

Note: Async and Defer are false by default. It is recommended to use these options wherever possible to improve page performance.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Excubo.Blazor.ScriptInjection:

Package Downloads
Basyc.MessageBus.Manager.Presentation.BlazorLibrary

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.1.7 1,794 12/1/2022
3.1.6 762 4/15/2022
3.1.4 448 3/9/2022
3.1.2 542 2/10/2022
3.1.0 488 11/9/2021
3.0.47 435 10/22/2021
3.0.45 443 9/15/2021
3.0.37 480 7/19/2021
3.0.33 376 6/11/2021
3.0.29 336 5/12/2021
3.0.25 840 4/7/2021
3.0.21 370 3/9/2021
3.0.17 402 3/3/2021
3.0.15 451 2/10/2021
3.0.11 452 1/13/2021
3.0.7 459 12/9/2020
3.0.5 456 11/13/2020
3.0.4 427 11/10/2020
3.0.3 8,338 10/13/2020
3.0.2 3,761 9/8/2020
3.0.1 2,876 8/12/2020
3.0.0 745 8/5/2020
2.0.2 2,866 6/28/2020
2.0.1 517 6/25/2020
2.0.0 514 6/25/2020
1.0.5 484 6/15/2020
1.0.4 490 5/14/2020
1.0.3 478 5/13/2020
1.0.2 494 5/13/2020
1.0.1 488 4/28/2020
1.0.0 581 3/31/2020