I already installed Fontawesome in my package.json.
"devDependencies": {
"@fortawesome/fontawesome-free": "^5.11.2" ,
//etc.
},
"dependencies": { "font-awesome": "^4.7.0" }
and import it to my app.scss
@import "~font-awesome/scss/font-awesome.scss";
I tried <i class="fa fa-edit"></i>
and <i class="fas fa-edit"></i>
but it just shows like this below, someone knows how to do this correctly?
Firstly import all
fontawesome-icons
in yourapp.scss
Second, and most important that you missed is to copy the webfonts to your public folder. In you
webpack.mis.js
append this below.My solution:
from the doc: https://fontawesome.com/how-to-use/on-the-web/setup/using-package-managers
npm install --save @fortawesome/fontawesome-free
Then, in app.js I imported 'all.js':
import fontawesome from '@fortawesome/fontawesome-free/js/all.js';
After
npm run watch
now I see the icons as<i class="fas fa-search"></i>
Laravel 6.x+ using Font Awesome 5 (The Right Way)
Build your webpack.mix.js configuration.
Install the latest free version of Font Awesome via a package manager like npm.
This dependency entry should now be in your package.json.
In your main SCSS file, /resources/sass/app.scss import one or more styles.
Compile your assets and produce a minified, production-ready build.
Finally, reference your generated CSS file in your Blade template/layout.
I would suggest you try this
In the
resources/assets/js
folder, create a new filefontawesome.js
In the file you can import fontawesome and all icons.
In
resources/assets/js/app.js
Now run
npm run dev
to compileThen you can use needed icon in your view
As you said you have already installed
font-awesome
package.app.scss
Add this line:
And then