Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Commit

Permalink
Fix Class blade.compiler does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jerodev authored Aug 30, 2019
1 parent 2e7f954 commit 3f72988
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/FontAwesomeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Jerodev\LaraFontAwesome;

use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\Compilers\BladeCompiler;
use Jerodev\LaraFontAwesome\Middleware\InjectStyleSheet;

class FontAwesomeServiceProvider extends ServiceProvider
Expand All @@ -23,15 +23,17 @@ public function boot()

private function registerBladeDirectives()
{
Blade::directive('fa', function ($expression) {
return BladeRenderer::renderGeneric($expression);
});

foreach (config('fontawesome.libraries') as $library) {
Blade::directive('fa' . $library[0], function ($expression) use ($library) {
return BladeRenderer::renderWithLibrary($expression, $library);
$this->app->afterResolving('blade.compiler', function (BladeCompiler $bladeCompiler) {
$bladeCompiler->directive('fa', function ($expression) {
return BladeRenderer::renderGeneric($expression);
});
}

foreach (config('fontawesome.libraries') as $library) {
$bladeCompiler->directive('fa' . $library[0], function ($expression) use ($library) {
return BladeRenderer::renderWithLibrary($expression, $library);
});
}
});
}

private function registerMiddleware($middleware)
Expand Down

0 comments on commit 3f72988

Please sign in to comment.