Skip to content

Commit

Permalink
Get Blade compiler from Engine Resolver (#23710)
Browse files Browse the repository at this point in the history
If one registers a custom Blade compiler ( such as https://github.com/HTMLMin/Laravel-HTMLMin ) that replaces the built-in compiler, all Blade directives registration through the Blade Façade are registered with the custom compiler and not the built-in one.

As the `view:cache` command didn't retrieve the compiler from the EngineResolver but used the built-in one, when a user that uses a custom compiler runs this command, no custom directive is compiled.

This commit fixes this by retrieving the compiler from the EngineResolver, so there are no conflicts with packages that register a custom Blade compiler.

(For reference see the Blade Façade: https://github.com/laravel/framework/blob/5.6/src/Illuminate/Support/Facades/Blade.php#L34 )
  • Loading branch information
rodrigopedra authored and taylorotwell committed Mar 27, 2018
1 parent ce879dd commit b1af528
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/ViewCacheCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function handle()
*/
protected function compileViews(Collection $views)
{
$compiler = $this->laravel['blade.compiler'];
$compiler = $this->laravel['view']->getEngineResolver()->resolve('blade')->getCompiler();

$views->map(function (SplFileInfo $file) use ($compiler) {
$compiler->compile($file->getRealPath());
Expand Down

0 comments on commit b1af528

Please sign in to comment.