How to include fonts in self contained Angular 2 component

后端 未结 1 1748
时光说笑
时光说笑 2021-01-18 07:37

I have a component that requires a custom font as a dependency. I\'d like the component to handle the import of the fonts itself so it\'s portable. Also, our projects are us

1条回答
  •  说谎
    说谎 (楼主)
    2021-01-18 07:58

    If you put files in /assets folder (inside src folder), you can refer the font with:

    @font-face {
      font-family: "Custom Font";
      src: url("/assets/my-custom-font.woff") format("woff")
    }
    

    and then use it in the html.

    0 讨论(0)
提交回复
热议问题