Why Blazor css isolation not work from UI in another class library?

101 Views Asked by At

I have a web executable project (client_server) with Blazor:
client_server
And class library (client_server_ui) for all pages:
client_server_ui

Trying to use CSS isolation, but css-styles defined as {ExamplePage}.razor.css are not added to {AssemblyName.styles.css}.

To connect, I tried to add to client_server_ui/_Host.html the following links:

  • <link href="client_server.styles.css" rel="stylesheet" /> (css file is generated, but does not contain styles from {ExamplePage}.razor.css
  • <link href="client_server_ui.styles.css" rel="stylesheet" /> (css file is not generated)

Is there a way to link {ExamplePage}.razor.css with CSS isolation from the class library?

{ExamplePage}.razor

@page "/example"

<h1>Scoped CSS Example</h1>

{ExamplePage}.razor.css

h1 { 
    color: brown;
    font-family: Tahoma, Geneva, Verdana, sans-serif;
}
0

There are 0 best solutions below