Marat
Marat

Reputation: 59

Why I'am getting wrong path in laravel to fontawesome?

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

Upvotes: 0

Views: 871

Answers (2)

Marat
Marat

Reputation: 59

SOLVED

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

Upvotes: 2

Juan Carlos Ibarra
Juan Carlos Ibarra

Reputation: 1419

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.

Upvotes: 0

Related Questions