Excubo.Blazor.ScriptInjection
1.0.0
See the version list below for details.
dotnet add package Excubo.Blazor.ScriptInjection --version 1.0.0
NuGet\Install-Package Excubo.Blazor.ScriptInjection -Version 1.0.0
<PackageReference Include="Excubo.Blazor.ScriptInjection" Version="1.0.0" />
paket add Excubo.Blazor.ScriptInjection --version 1.0.0
#r "nuget: Excubo.Blazor.ScriptInjection, 1.0.0"
// Install Excubo.Blazor.ScriptInjection as a Cake Addin #addin nuget:?package=Excubo.Blazor.ScriptInjection&version=1.0.0 // Install Excubo.Blazor.ScriptInjection as a Cake Tool #tool nuget:?package=Excubo.Blazor.ScriptInjection&version=1.0.0
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 | Versions 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. |
-
.NETCoreApp 3.1
- Microsoft.AspNetCore.Components.Web (>= 3.1.3)
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,890 | 12/1/2022 |
3.1.6 | 768 | 4/15/2022 |
3.1.4 | 454 | 3/9/2022 |
3.1.2 | 548 | 2/10/2022 |
3.1.0 | 494 | 11/9/2021 |
3.0.47 | 441 | 10/22/2021 |
3.0.45 | 449 | 9/15/2021 |
3.0.37 | 486 | 7/19/2021 |
3.0.33 | 382 | 6/11/2021 |
3.0.29 | 341 | 5/12/2021 |
3.0.25 | 846 | 4/7/2021 |
3.0.21 | 377 | 3/9/2021 |
3.0.17 | 408 | 3/3/2021 |
3.0.15 | 457 | 2/10/2021 |
3.0.11 | 458 | 1/13/2021 |
3.0.7 | 465 | 12/9/2020 |
3.0.5 | 462 | 11/13/2020 |
3.0.4 | 433 | 11/10/2020 |
3.0.3 | 8,344 | 10/13/2020 |
3.0.2 | 3,767 | 9/8/2020 |
3.0.1 | 2,882 | 8/12/2020 |
3.0.0 | 751 | 8/5/2020 |
2.0.2 | 2,874 | 6/28/2020 |
2.0.1 | 523 | 6/25/2020 |
2.0.0 | 520 | 6/25/2020 |
1.0.5 | 490 | 6/15/2020 |
1.0.4 | 496 | 5/14/2020 |
1.0.3 | 484 | 5/13/2020 |
1.0.2 | 500 | 5/13/2020 |
1.0.1 | 494 | 4/28/2020 |
1.0.0 | 587 | 3/31/2020 |