Support the ongoing development of Laravel.io →
Installation Configuration
Last updated 1 year ago.
0

Simplest way would be to download it from their website, put required files inside public/ dir and use blades HTML::style to include it in master file.

Another way would be using a task runner like gulp or grunt. And since FontAwesome is more of a front-end thing, I'd suggest using Bower to download it. That is more of a front-end package manager, and Composer is php package/dependency manager

Last updated 1 year ago.
0

Thanks for the reply. I am trying to avoid manually placing libraries in my public/ directory because I want to be able to take advantage of automatically updating my packages. I also do not want to use an outside connection to reference it from a CDN, so a local, update-able copy is what I'm looking for.

I checked out Bower as you suggested and it looks like it is very similar to composer, but I am hesitant to use it because I don't think separating frontend from dependency is the way to go for my project. My app WILL "depend" on using FontAwesome, much like it will need Bootstrap, Datatables, etc. I want to avoid having to maintain 2 (or more) package managers, but at the same time use best practices to achieve my goals.

Are you suggesting that it is not possible to use composer to setup FontAwesome in Laravel? Do you know if there is a tutorial available to set it up using composer only?

Last updated 1 year ago.
0

The package is on packagist.org so I suppose it is possible. The thing with it and Bower is that they save it in their directory (vendor/font-awesome) or something. That is why you'd need a task runner like grunt or gulp with the appropriate packages installed to copy the required files from "vendor/something" to "public/something". Or copy/paste manually but I'm guessing that's not what you want.

Gulp is easier to setup and it shouldn't take you longer than an hour to figure out the basics

Last updated 1 year ago.
0

I solved with the steps below:

  1. Install fontawesome from packagist:

    Source:

    https://packagist.org/packages/components/font-awesome
    

    Execute:

    $ composer require components/font-awesome
    
  2. Call publishes inside boot method on app/Providers/AppServiceProvider and set to public:

    $this->publishes([
        __DIR__ . '/../../vendor/components/font-awesome/css' => public_path('vendor/components/font-awesome/css'),
        __DIR__ . '/../../vendor/components/font-awesome/fonts' => public_path('vendor/components/font-awesome/fonts')
            ], 'public');
    
  3. In composer.json file add "php artisan vendor:publish --tag=public --force" in:

    scripts > post-install-cmd array and scripts > post-update-cmd array

  4. Execute the same command in terminal:

    $ php artisan vendor:publish --tag=public --force
    
  5. Then, all needed files to work with fontawesome will be copy to folder:

    public/vendor/
    
  6. Add link tag in your html head's tag:

    <link href="<?= asset('vendor/components/font-awesome/css/font-awesome.min.css') ?>" rel="stylesheet">
    
  7. You're done!

Last updated 6 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.