How to Install and Use Font Awesome Icons in Laravel?

About Us:

We are from free coder. We are a group of web developers who are passionate about web development. You can learn from us php, laravel, node js, vue js, react js and many other topic on web developement.
we are very happy to help you.
free coder

Today what you are going to learn:

In this tute, we will discuss how to install font awesome in laravel. if you have question about how to use fontawesome in laravel then i will give simple lesson with solution. i explained simply about install font awesome laravel 7. you can see install font awesome in laravel.

In this lesson i will show you step by step how to install font awesome icons in laravel mix. i will give you two lesson of installing font awesome in laravel. one will be using npm command using laravel mix and another lesson will using cdn js.

You can easily use font awesome icon in laravel 6, laravel 7 and laravel 8 version. so let's see bellow step be step process.

1) Install Using Npm

first, we will install laravel fresh version. so let's run bellow command:

composer create-project --prefer-dist laravel/laravel blog

Now, we need to install npm in our new laravel application. so let's simply run bellow command. this command will create "mode_modules" folder in your root directory and store all npm module there.

npm install

After that we need to install font awesome library using bellow npm command. so let's run bellow command:

npm install font-awesome --save

After install successfully, we need to import font awesome css on app.scss file. so let's import as bellow:

resources/sass/app.scss

@import "node_modules/font-awesome/scss/font-awesome.scss";

Now we are ready to run npm dev command, so let's run bellow command:

npm run dev

Hello Brother, we will use generated app.css file in our blade file as bellow:

resources/views/welcome.blade.php

<!DOCTYPE html>

<html>

<head>

<title>How to use font awesome in Laravel? - ItSolutionStuff.com</title>

<link type="text/css" rel="stylesheet" href="{{ mix('css/app.css') }}">

<style type="text/css">

i{

font-size: 50px !important;

padding: 10px;

}

</style>

</head>

<body>

<h1>How to use font awesome in Laravel? - ItSolutionStuff.com</h1>

<i class="fa fa-copy"></i>

<i class="fa fa-save"></i>

<i class="fa fa-trash"></i>

<i class="fa fa-home"></i>

</body>

</html>

Now you can run your application and see on home page. You will get layout as bellow:

2) Install Using CDNJS

here, we will use cdn js file for adding font awesome icons, so let see bellow file code:

resources/views/welcome.blade.php

<!DOCTYPE html>

<html>

<head>

<title>How to use font awesome in Laravel? - ItSolutionStuff.com</title>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/fontawesome.min.css" />

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css" />

<style type="text/css">

i{

font-size: 50px !important;

padding: 10px;

}

</style>

</head>

<body>

<h1>How to use font awesome in Laravel? - ItSolutionStuff.com</h1>

<i class="fa fa-copy"></i>

<i class="fa fa-save"></i>

<i class="fa fa-trash"></i>

<i class="fa fa-home"></i>

</body>

</html>

thank you very much for following up with me.

Tags

Recent Posts

Related Posts