我通过执行以下步骤将fontawesome添加到我的网站:
-
webpack.mix.js配置。
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');
-
npm install @fortawesome/fontawesome-free
-
在我的package.json中。
// Font Awesome
"dependencies": {
"@fortawesome/fontawesome-free": "^5.13.0",
-
在我的app.scss中
// Fonts
@import url('https://fonts.googleapis.com/css?family=Roboto+Slab:300,400,700&display=swap');
@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700&display=swap');
// Variables
@import 'variables';
// Bootstrap
@import '~bootstrap/scss/bootstrap';
//Fontawesome
@import '~@fortawesome/fontawesome-free/scss/fontawesome';
@import '~@fortawesome/fontawesome-free/scss/regular';
@import '~@fortawesome/fontawesome-free/scss/solid';
@import '~@fortawesome/fontawesome-free/scss/brands';
当我奔跑时
npm run dev
我的文件夹中的fontawesome css目录位置
app.css
是
url(/fonts/vendor/@fortawesome/fontawesome-free/webfa-regular-400.eot?6b20949b3a679c30d09f64acd5d3317d);
而不是
url(../fonts/vendor/@fortawesome/fontawesome-free/webfa-regular-400.eot?6b20949b3a679c30d09f64acd5d3317d);
你知道怎么解决这个问题吗?Laravel的新成员,从Yii 1迁移而来。非常感谢。