28
23

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+FontAwesomeの使い方

Posted at

Laravel+FontAwesomeの使い方

バージョン

  • Laravel: 5.6
  • node: v8.11.4
  • npm: 5.6.0
  • fontawesome-free: 5.3.1

前提条件

  • Laravelのセットアップが完了していること
  • npm installでjavascriptの初期パッケージがインストール済みであること

参考: https://readouble.com/laravel/5.6/ja/mix.html

FontAwesomeのインストール

npmでインストールします

cd /path/to/laravel-project
npm install @fortawesome/fontawesome-free --save-dev

Webpackの設定

resouces/assets/sass/app.scss
// Font Awesome
@import '~@fortawesome/fontawesome-free/scss/fontawesome';
@import '~@fortawesome/fontawesome-free/scss/solid';
@import '~@fortawesome/fontawesome-free/scss/regular';
@import '~@fortawesome/fontawesome-free/scss/brands';

solid, regular, brands は必要なものだけでもOK

アセットコンパイル

npm run dev

使用方法

下記のサイトで適当なアイコンを探してテンプレートに張り付ける
https://fontawesome.com/icons?d=gallery

*.blade.php
<i class="fas fa-check"></i>
28
23
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
28
23

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?