owenvoke / blade-fontawesome

A package to easily make use of Font Awesome in your Laravel Blade views.
https://packagist.org/packages/owenvoke/blade-fontawesome
MIT License
170 stars 30 forks source link

Faster Loading #26

Closed df999 closed 3 years ago

df999 commented 3 years ago

Make blade-fontawesome load faster

Description

Hey guys - great package, but I noticed it really adds a lot of overhead to every Laravel page load (about 500ms in my local environment!). Normally, my local dev page loads are about 300ms, so it reaches 800ms with this package installed.

Possible implementation

It seems to come from these lines in the BladeFontAwesomeServiceProvider ServiceProvider:

$factory->add('fontawesome-brands', array_merge(['path' => __DIR__.'/../resources/svg/brands'], $config->get('blade-fontawesome.brands', [])));
$factory->add('fontawesome-regular', array_merge(['path' => __DIR__.'/../resources/svg/regular'], $config->get('blade-fontawesome.regular', [])));
$factory->add('fontawesome-solid', array_merge(['path' => __DIR__.'/../resources/svg/solid'], $config->get('blade-fontawesome.solid', [])));

Is there a way to speed this up somehow?

Thanks!

owenvoke commented 3 years ago

Out of interest, have you cached your files using the php artisan icons:cache command? As far as I know that's about all that can help at the moment as there are so many icons in this package.

df999 commented 3 years ago

Ahhh thanks. Yes, that made all the difference! I didn't see that option in your readme and didn't think to check out the main blade-ui-kit/blade-icons package.

Thanks again!

owenvoke commented 3 years ago

I'll add a note about it on the package docs as well. 👍🏻