CSS from Blazor Component Lib not loaded

huangapple go评论72阅读模式
英文:

CSS from Blazor Component Lib not loaded

问题

I want to use my custom CSS located in wwwroot/css/ in my BlazorControllers/Components/ files, but nothing is loaded during execution. Is there something I need to specify in the client or library project settings?

My library project is BlazorControllers, and I'm using the library's components in the client project.

英文:

I want to use my customs CSS located on the wwwroot/css/. in my BlazorControllers/Components/. files but nothing is loaded at execution.
Is there something to specify in the client or in the lib project settings ?

My Library project is BlazorControllers and I use the component of the library in the Client project

CSS from Blazor Component Lib not loaded

答案1

得分: 8

在你的Index.html(或_Host.cshtml)文件中,在site.css行下添加:

<link href="_content/<YourLibrary>/styles.css" rel="stylesheet" />

其中<YourLibrary> 在你的情况下似乎是BlazorControllers。

并且,如果我理解图片正确的话,你还需要添加:

<link href="_content/BlazorControllers/css/MyComponents.css" rel="stylesheet" />
英文:

In your Index.html (or _Host.cshtml) file, below the site.css line, add

&lt;link href=&quot;_content/&lt;YourLibrary&gt;/styles.css&quot; rel=&quot;stylesheet&quot; /&gt;

where &lt;YourLibrary&gt; seems to be BlazorControllers in your case.

And when I read that picture right you (also) need

&lt;link href=&quot;_content/BlazorControllers/css/MyComponents.css&quot; rel=&quot;stylesheet&quot; /&gt;

huangapple
  • 本文由 发表于 2020年1月6日 16:45:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/59609028.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定