简体   繁体   English

使用angular-cli,sass和materialize-css找不到字体

[英]Font not found with angular-cli, sass and materialize-css

I'm working in a project when I'm using angular-cli and materialize-css, for the styles I'm using sass by default. 当我使用angular-cli和materialize-css时,我正在一个项目中工作,默认情况下我使用的是sass。 When I import the sass files from the lib: @import "~materialize-css/sass/materialize"; 当我从库中导入sass文件时:@import“〜materialize-css / sass / materialize”;

The app find the styles but not the roboto fonts 该应用程序找到样式,但找不到roboto字体

I tried to put it directly in the styles inside of the angular-cli.json file and I have the same error. 我试图将其直接放置在angular-cli.json文件内部的样式中,并且遇到相同的错误。 I think that materialize-css sass cannot resolve the Fonts path. 我认为materialize-css sass无法解析字体路径。

The Roboto font will be not automatically loaded by AngularJS Material itself. AngularJS材质本身不会自动加载Roboto字体。

The developer is responsible for loading all fonts used in their application. 开发人员负责加载其应用程序中使用的所有字体。

You can host it yourself or include it from Google Fonts: 您可以自己托管它,也可以从Google字体中添加它:

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic">

please see the link. 请参阅链接。

https://material.angularjs.org/latest/CSS/typography https://material.angularjs.org/latest/CSS/typography



If you want to use NPM you can use Webpack+NPM 如果要使用NPM,可以使用Webpack + NPM

For more info please see the link 有关更多信息,请参见链接

https://github.com/pablorsk/test-generator-fountain-webapp-angular-material https://github.com/pablorsk/test-generator-fountain-webapp-angular-material

$ npm install --save-dev file-loader
$ npm install --save roboto-fontface


Hope this helps 希望这可以帮助

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

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