Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
20
Help us understand the problem. What is going on with this article?
@algi_nao

Laravel+FontAwesomeの使い方

More than 1 year has passed since last update.

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>
20
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
algi_nao
ひとりSEやってます はまった時の備忘録用

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
20
Help us understand the problem. What is going on with this article?