Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions aspnetcore/blazor/components/class-libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ Welcome to your new app.

Optionally, include the `@using ComponentLibrary` directive in the top-level `_Import.razor` file to make the library's components available to an entire project. Add the directive to an `_Import.razor` file at any level to apply the namespace to a single component or set of components within a folder.

<!-- HOLD for reactivation at 5.x

::: moniker range=">= aspnetcore-5.0"

To provide `Component1`'s `my-component` CSS class to the component, link to the library's stylesheet using the framework's [`Link` component](xref:blazor/fundamentals/additional-scenarios#influence-html-head-tag-elements) in `Component1.razor`:
Expand Down Expand Up @@ -136,6 +138,8 @@ When the `Link` component is used in a child component, the linked asset is also

::: moniker range="< aspnetcore-5.0"

-->

To provide `Component1`'s `my-component` CSS class, link to the library's stylesheet in the app's `wwwroot/index.html` file (Blazor WebAssembly) or `Pages/_Host.cshtml` file (Blazor Server):

```html
Expand All @@ -145,8 +149,12 @@ To provide `Component1`'s `my-component` CSS class, link to the library's styles
</head>
```

<!-- HOLD for reactivation at 5.x

::: moniker-end

-->

## Create a Razor components class library with static assets

An RCL can include static assets. The static assets are available to any app that consumes the library. For more information, see <xref:razor-pages/ui-class#create-an-rcl-with-static-assets>.
Expand Down
6 changes: 5 additions & 1 deletion aspnetcore/blazor/fundamentals/additional-scenarios.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Learn about additional scenarios for ASP.NET Core Blazor hosting mo
monikerRange: '>= aspnetcore-3.1'
ms.author: riande
ms.custom: mvc
ms.date: 08/12/2020
ms.date: 10/27/2020
no-loc: ["ASP.NET Core Identity", cookie, Cookie, Blazor, "Blazor Server", "Blazor WebAssembly", "Identity", "Let's Encrypt", Razor, SignalR]
uid: blazor/fundamentals/additional-scenarios
---
Expand Down Expand Up @@ -284,6 +284,8 @@ window.addEventListener('pagehide', () => {
});
```

<!-- HOLD for reactivation at 5x

## Influence HTML `<head>` tag elements

*This section applies to the upcoming ASP.NET Core 5.0 release of Blazor WebAssembly and Blazor Server.*
Expand Down Expand Up @@ -315,6 +317,8 @@ When one of the framework components is used in a child component, the rendered
* Can be modified by application state. A hard-coded HTML tag can't be modified by application state.
* Is removed from the HTML `<head>` when the parent component is no longer rendered.

-->

::: moniker-end

## Static files
Expand Down
16 changes: 16 additions & 0 deletions aspnetcore/blazor/host-and-deploy/webassembly.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ Use the following approaches for static assets:
<img alt="..." src="_content/{LIBRARY NAME}/{ASSET FILE NAME}" />
```

<!-- HOLD for reactivation at 5.x

::: moniker range=">= aspnetcore-5.0"

Components provided to a client app by a class library are referenced normally. If any components require stylesheets or JavaScript files, use either of the following approaches to obtain the static assets:
Expand All @@ -286,10 +288,16 @@ The preceding approaches are demonstrated in the following examples.

::: moniker range="< aspnetcore-5.0"

-->

Components provided to a client app by a class library are referenced normally. If any components require stylesheets or JavaScript files, the client app's `wwwroot/index.html` file must include the correct static asset links. These approaches are demonstrated in the following examples.

<!-- HOLD for reactivation at 5.x

::: moniker-end

-->

Add the following `Jeep` component to one of the client apps. The `Jeep` component uses:

* An image from the client app's `wwwroot` folder (`jeep-cj.png`).
Expand Down Expand Up @@ -322,6 +330,8 @@ Add the following `Jeep` component to one of the client apps. The `Jeep` compone
> [!WARNING]
> Do **not** publish images of vehicles publicly unless you own the images. Otherwise, you risk copyright infringement.

<!-- HOLD for reactivation at 5.x

::: moniker range=">= aspnetcore-5.0"

The library's `jeep-yj.png` image can also be added to the library's `Component1` component (`Component1.razor`). To provide the `my-component` CSS class to the client app's page, link to the library's stylesheet using the framework's [`Link` component](xref:blazor/fundamentals/additional-scenarios#influence-html-head-tag-elements):
Expand Down Expand Up @@ -355,6 +365,8 @@ An alternative to using the [`Link` component](xref:blazor/fundamentals/addition

::: moniker range="< aspnetcore-5.0"

-->

The library's `jeep-yj.png` image can also be added to the library's `Component1` component (`Component1.razor`):

```razor
Expand All @@ -380,8 +392,12 @@ The client app's `wwwroot/index.html` file requests the library's stylesheet wit
</head>
```

<!-- HOLD for reactivation at 5.x

::: moniker-end

-->

Add navigation to the `Jeep` component in the client app's `NavMenu` component (`Shared/NavMenu.razor`):

```razor
Expand Down
6 changes: 0 additions & 6 deletions aspnetcore/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -357,20 +357,14 @@
href: blazor/forms-validation.md#built-in-forms-components
- name: InputTextArea
href: blazor/forms-validation.md#built-in-forms-components
- name: Link
href: blazor/fundamentals/additional-scenarios.md#influence-html-head-tag-elements
- name: MainLayout
href: blazor/layouts.md#mainlayout-component
- name: Meta
href: blazor/fundamentals/additional-scenarios.md#influence-html-head-tag-elements
- name: NavLink
href: blazor/fundamentals/routing.md#navlink-component
- name: NavMenu
href: blazor/fundamentals/routing.md#navlink-component
- name: Router
href: blazor/fundamentals/routing.md#route-templates
- name: Title
href: blazor/fundamentals/additional-scenarios.md#influence-html-head-tag-elements
- name: Virtualize
uid: blazor/components/virtualization
- name: Cascading values and parameters
Expand Down