如何在Laravel Mix中安装Font Awesome
2022-08-30 08:18:59
我尝试使用Laravel Mix安装Font Awesome,但在执行时,我收到以下消息:run npm dev
错误 编译失败,在 ./~/font-awesome/scss/font-awesome.scss 模块构建失败时出现 1 个错误
错误: /** ^ “...加载样式“:预期的 1 个选择器或 at-rule,是 /var/www/html/blog/node_modules/font-awesome/scss/font-awesome.scss 中的”var content = requi“(第 1 行,第 1 列)
我删除了文件中的注释并尝试更改字体路径,但这并没有解决问题。
webpack.mix.js
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
.copy('node_modules/font-awesome/fonts/', 'public/fonts')
.sass('node_modules/font-awesome/scss/font-awesome.scss', 'public/css')
.version();
fontawesome.scss
@import "variables";
@import "mixins";
@import "path";
@import "core";
@import "larger";
@import "fixed-width";
@import "list";
@import "bordered-pulled";
@import "animated";
@import "rotated-flipped";
@import "stacked";
@import "icons";
@import "screen-reader";
_variable.scss
// Variables
// --------------------------
$fa-font-path: "../fonts" !default;
$fa-font-size-base: 14px !default;
$fa-line-height-base: 1 !default;
// $fa-font-path: "//netdna.bootstrapcdn.com/font-awesome/4.7.0/fonts" !default; // for referencing Bootstrap CDN font files directly
$fa-css-prefix: fa !default;
$fa-version: "4.7.0" !default;
$fa-border-color: #eee !default;
$fa-inverse: #fff !default;
$fa-li-width: (30em / 14) !default;
// Continue...