如何在Ionic 4项目中添加font-awsome?
问题描述:
是否有人知道将font-awsome
添加到新的Ionic 4项目的方法(当前我正在使用4.0.0-beta.15
).
Does anyone knows the way of adding font-awsome
to new Ionic 4 project (currently I'm using 4.0.0-beta.15
).
将其添加到v3的方法在这里得到了很好的解释:
Adding it to v3 is nicely explained here:
https://charlouze .github.io/ionic/2017/05/31/Ionic-3-and-Font-Awesome.html
它适用于Ionic V3,但不幸的是不适用于V4.
and it works great for Ionic V3, but unfortunatelly not V4.
答
安装真棒字体
npm install font-awesome --save --save-exact
install font-awesome
npm install font-awesome --save --save-exact
copyFonts: {
src: [
'{{ROOT}}/node_modules/ionicons/dist/fonts/**/*',
'{{ROOT}}/node_modules/ionic-angular/fonts/**/*',
'{{ROOT}}/node_modules/font-awesome/fonts/**/*'],
dest: '{{WWW}}/assets/fonts'
},
sass.config.js
includePaths: [
'node_modules/ionic-angular/themes',
'node_modules/ionicons/dist/scss',
'node_modules/ionic-angular/fonts',
'node_modules/font-awesome/scss'
],
variable.scss
$fa-font-path: $font-path;
@import "font-awesome";
home.html
<i class="fa fa-users"></i>
请按照上述步骤操作.那对我有用.
Please follow the above steps. That is working for me.