5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Laravel 6.x Font Awesome 5を導入メモ

Posted at

タイトル通りです。

/resources/sass/app.scss
@import '~@fortawesome/fontawesome-free/scss/fontawesome';
@import '~@fortawesome/fontawesome-free/scss/brands';
@import '~@fortawesome/fontawesome-free/scss/solid';
@import '~@fortawesome/fontawesome-free/scss/regular';
npm run dev
/resources/view/app.blade.php
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">

できたできたと思ったら、

GET http://localhost/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.woff2?462806316fea535a6a57651bc2b000b0 net::ERR_ABORTED 404 (Not Found)

なぜかFontsリソースがNot Found
webpackファイルも書き換えが必要とのこと

webpack.mix.js
mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css')
    .setResourceRoot('../');

無事に表示!!
1時間ぐらいハマってしまった。。。

#参考
https://stackoverflow.com/questions/54839609/how-to-change-the-import-path-of-fontawesome-with-laravel-5-7

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?