0
0

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 5 years have passed since last update.

LaravelでFontAwsomeを使う方法

0
Last updated at Posted at 2020-10-02

タイトル通り、LaravelでFontAwsomeを使う方法を2種類以下に書いていく。あくまでも自分の備忘録。

Ver7系
すでに、Laravel Mixが使える環境にある。

CDNを使う方法

これは、他の記事を見るように。

インストールして使う方法

プロジェクト上で、

npm install @fortawesome/fontawesome-free

を実行。

その後、グローバルに登録するために、app.jsに以下を追加。

/resources/js/app.js
import '@fortawesome/fontawesome-free/js/fontawesome';
import '@fortawesome/fontawesome-free/js/solid';
import '@fortawesome/fontawesome-free/js/regular';

これでhtmlで使えるようになった。npm run watchやscriptタグでのapp.jsの読み込みを忘れずに。

index.html
<head>
    <script src="{{ mix('js/app.js') }}" defer></script>
</head>

<body>
    <div id="app">
        <i class="fas fa-dog fa-3x"></i>
    </div>
</body>

わんちゃんが出現~。

以上。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?