Skip to content

Commit

Permalink
enable configuration of loader file extension (#222)
Browse files Browse the repository at this point in the history
Co-authored-by: Will West <[email protected]>
  • Loading branch information
will0 and Will West authored May 7, 2022
1 parent 395fed7 commit 4bea7e7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Roots/Acorn/View/ViewServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,12 @@ public function registerMacros()
$path = $this->getPath();
$id = md5($this->getCompiled());
$compiled_path = $app['config']['view.compiled'];
$compiled_extension = $app['config']->get('view.compiled_extension', 'php');

$content = "<?= \\Roots\\view('{$view}', \$data ?? get_defined_vars())->render(); ?>"
. "\n<?php /**PATH {$path} ENDPATH**/ ?>";

if (! file_exists($loader = "{$compiled_path}/{$id}-loader.php")) {
if (! file_exists($loader = "{$compiled_path}/{$id}-loader.{$compiled_extension}")) {
file_put_contents($loader, $content);
}

Expand Down

0 comments on commit 4bea7e7

Please sign in to comment.