简体   繁体   English

我如何在两个 Blazor 项目之间添加共享的 css?

[英]How i can add shared css between two Blazor Project?

I have two projects, one with MAUI, and another Blazor, do i have any chance to share one common css file between these two projects?我有两个项目,一个是 MAUI,另一个是 Blazor,我有机会在这两个项目之间共享一个通用的 css 文件吗?

I already tried to add this to the shared project, but the problem, it's, I cannot get any access to it, from the launched project, because I don`t have it in www root.我已经尝试将它添加到共享项目中,但问题是,我无法从启动的项目中访问它,因为我没有它在 www root 中。

The link to the CSS file must be - <link src="_content/{ExternalLibrary}/{name}.css"></link> - Where {ExternalLibrary} it is the name of the Shared library, and {name} it`s the name of CSS file, which styles we want to import. CSS 文件的链接必须是 - <link src="_content/{ExternalLibrary}/{name}.css"></link> - {ExternalLibrary}是共享库的名称, {name}是`s CSS文件的名称,我们要导入的样式。 Also, this library must be a Razor class library.此外,此库必须是 Razor 类库。

I think you need a bundle to reuse static files such as js, css etc.我认为你需要一个包来重用静态文件,如 js、css 等。

Check this article https://www.syncfusion.com/faq/blazor/general/how-do-you-bundle-and-minify-the-css-and-js-files-in-blazor-applications查看这篇文章https://www.syncfusion.com/faq/blazor/general/how-do-you-bundle-and-minify-the-css-and-js-files-in-blazor-applications

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我如何像Vue那样从父层随机添加CSS属性到Blazor组件? - How can I randomly add CSS attributes to Blazor component from parent layer as Vue did? 共享 CSS 文件 blazor - Shared CSS file blazor 查看 .NET 标准项目中 WPF 和 Blazor 之间共享的模型 - View models shared between WPF and Blazor in a .NET Standard project 如何使用“条纹”表解决此 Blazor/Bootstrap 5 CSS 问题? - How can I fix this Blazor/Bootstrap 5 CSS issue with "striped" tables? 如何在共享通用项目和后台任务之间共享代码? - How can I share code between a Shared Universal project and a Background Task? 如何使用 Blazor 中的 DataAnnotationsValidator 验证两个字段是否匹配? - How can I verify that two fields match using DataAnnotationsValidator in Blazor? 如何将 NugetPackages 添加到共享项目? - How to add NugetPackages to Shared Project? 如何重命名 Blazor WASM 项目? - How do I rename a Blazor WASM project? 示例 Blazor 项目中计数器的状态是否可以在页面切换之间保留? - Can the state of the Counter in the example Blazor project be preserved between page switches? Blazor wasm,网络核心托管,具有身份验证,应用程序用户和我的模型在共享项目中的关系 - Blazor wasm, net core hosted, with authentication, relationships between applicationuser and my models in the shared project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM