Reputation: 83
I followed this particular answer to install Font Awesome in a Laravel 5.7 instance running on a LAMP application stack.
npm run <option>
finishes without error. In the browser, Font Awesome icons don't load, but php artisan serve
loads icons. I suppose I'm failing to include compiled /css/app.css
and /js/app.js.
What might I be missing?
EDIT
I didn't write any code. All I did is run a few commands from the terminal. My system
Debian Stretch (4.9), PHP 7.2.9, Apache 2.4.25
I installed Laravel with Composer. app.js
and app.css
files have exactly same page source when served using php artisan serve
and navigating to localhost/... /laravel/public
. So script and style files are loaded, why doesn't it work?
Upvotes: 5
Views: 1180
Reputation: 399
Here is my implementation of FontAwesome. Further examples can be found in my personal web page project, but the initialization takes place in resources/assets/js/bootstrap.js. It looks like this:
import fontawesome from '@fortawesome/fontawesome';
import faFacebook from '@fortawesome/fontawesome-free-brands/faFacebook';
import faGithub from '@fortawesome/fontawesome-free-brands/faGithub';
import faLinkedin from '@fortawesome/fontawesome-free-brands/faLinkedin';
import faFileAlt from '@fortawesome/fontawesome-free-solid/faFileAlt';
import faDownload from '@fortawesome/fontawesome-free-solid/faDownload';
fontawesome.dom.i2svg();
fontawesome.library.add([
faFacebook,
faGithub,
faLinkedin,
faFileAlt,
faDownload
]);
I then use it within my blade templates as follows:
<i style="color: #3097D1" class="fab fa-facebook fa-8x"></i>
Upvotes: 1