0

Laravel 5.7 FontAwesome 5.7.1

I installed fontawesome via npm and imported in app.scss Everything is fine, but problem is that I removed public/ from my url in order to access without this specific word / www.domain.com/public

So now my app trying to access fontawesome by this address https://test.local/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.woff2?3638e62 but this is wrong path because there should be public/ folder in address it must be so https://test.local/public/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.woff2?3638e62 If I manually add public word to address then I access to font awesome

My webpack file

mix.js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css')
   .options({ processCssUrls: false });

Any help

Marat
  • 59
  • 8
  • There *shouldn't* be a public folder in your URLs. That indicates you've set up your server in an insecure manner - `test.local` should be pointed directly at that `public` folder. – ceejayoz Feb 06 '19 at 20:05
  • And how to do so? Should I have to write smth into .htaccess file? – Marat Feb 07 '19 at 09:21
  • Does this answer your question? [Laravel 5.7 + Font Awesome](https://stackoverflow.com/questions/52433486/laravel-5-7-font-awesome) – Karl Hill Jun 09 '20 at 04:31

2 Answers2

2

SOLVED

I put mix.setResourceRoot('/public/'); into webpack.mix.js and run npm install so it worked for me

Marat
  • 59
  • 8
0

In your resources/sass/app.scss add this line:

@import '~@fortawesome/fontawesome-free/css/all';

Then run npm run dev in the console. That way worked for me.

Juan Carlos Ibarra
  • 1,299
  • 14
  • 15