1

How to add font-awesome to laravel project. I ran:

npm install font-awesome

But what is next, how to import it in my app.scss what is correct path? I am trying : @import "/node_modules/font-awesome/scss/font-awesome.scss"; But get and error:

ERROR in ./resources/assets/sass/app.scss

Module build failed: ModuleBuildError: Module build failed: @import "/node_modules/font-awesome/scss/font-awesome.scss";

Aipo
  • 1,805
  • 3
  • 23
  • 48

1 Answers1

9

If you're pulling a file in from your node_modules directory you can use ~ followed by the path to the file inside node_modules:

@import '~font-awesome/scss/font-awesome';

If you have:

mix.options({
    processCssUrls: false
});

Then you will need to copy the files in your webpack.mix.js file with something like:

mix.copy('./node_modules/font-awesome/fonts/**', 'public/fonts/font-awesome');

And then above the @import in your .scss file have:

$fa-font-path: '/fonts/font-awesome';
Rwd
  • 34,180
  • 6
  • 64
  • 78