BlazorSections 1.0.0

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

// Install BlazorSections as a Cake Tool
#tool nuget:?package=BlazorSections&version=1.0.0                

Blazor Sections Component

A component for adding sections similar to ASP.NET Core MVC sections.

  • Adding dynamically javascript
  • Adding dynamically css
  • Creating html-elements (e.g. title, metatags, etc.)

*** Currently only tested for server-side Blazor ***

Planned features

  • Adding Blazor components to section

Installation

Install via Nuget.

Install-Package BlazorSections 

Configuration

Startup.cs
// Import Blazor.Auth0
using Blazor.Auth0;
using Blazor.Auth0.Models;
// ...

public void ConfigureServices(IServiceCollection services)
{
	// Other code...

     services.AddScoped<BlazorSectionLib.SectionService>()
     
	// Other code...
}

Add your sections whereever you want in the _Host.cshtml. The SectonName parameter is required.

_Host.cshtml
@page "/"
...
@using BlazorSectionLib
...

<!DOCTYPE html>
<html lang="en">
<head>
    ...
    @(await Html.RenderComponentAsync<SectionComponent>(RenderMode.ServerPrerendered, new { SectionName = "head" }))
</head>
<body>
    <app>
        @(await Html.RenderComponentAsync<App>(RenderMode.ServerPrerendered))
    </app>
    @(await Html.RenderComponentAsync<SectionComponent>(RenderMode.ServerPrerendered, new { SectionName = "body" }))
    ...
</body>
</html>

Usage

Page or Component
@page "/head"
...
@using BlazorSectionLib
@inject SectionService _ss

...

@code {
    protected override async Task OnInitializedAsync()
    {
        _ss.AddElement("head", new SectionService.Element("title", "Jquery loaded"));
        _ss.AddElement("head", new SectionService.Javascript("https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"));
    }

...

}

Authors

InspGadget

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.0.3 2,166 12/14/2019
1.0.2 465 12/11/2019
1.0.1 301 12/10/2019
1.0.0 298 12/10/2019