简体   繁体   English

通过 Angular Nx Storybook 在库组件中使用 Material 图标

[英]Using Material icons inside a library component with Angular Nx Storybook

i am having hard time in using Angular material icons in Nx storybook.我很难在 Nx 故事书中使用 Angular 素材图标。

Here is how these are configured in angular.json, i think i am not configuring it correctly, please let me know what is the correct way to do it.这是在 angular.json 中的配置方式,我想我没有正确配置它,请告诉我正确的方法是什么。 Please note I cannot use link as following since, i am building a library, its not an application.请注意我不能使用如下链接,因为我正在构建一个库,它不是一个应用程序。

<link
      href="https://fonts.googleapis.com/icon?family=Material+Icons"
      rel="stylesheet"
    />

在此处输入图像描述

在此处输入图像描述

This is how icon is showing up.这就是图标的显示方式。 在此处输入图像描述

I did this way.我是这样做的。 you can try this你可以试试这个

npm install material-design-icons

 // angular.json

   "styles": [
     "node_modules/material-design-icons/iconfont/material-icons.css"
   ]

// style.css
   @import '~material-design-icons/iconfont/material-icons.css';
 
// html  
<i class="material-icons">cloud_upload</i>

在此处输入图像描述

Also i found the correct way to specify third party css for storybook ( i am using Angular).我还找到了为故事书指定第三方 css 的正确方法(我使用的是 Angular)。 It should go under build-storybook --> options section in angular.json file.它应该是 go 在 angular.json 文件中的 build-storybook --> options 部分。

在此处输入图像描述

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM