Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template hierarchy filter: Preserve existing paths #141

Merged
merged 9 commits into from
Mar 18, 2024
8 changes: 7 additions & 1 deletion src/Roots/Acorn/Sage/Concerns/FiltersTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Roots\Acorn\Sage\Concerns;

use Illuminate\Support\Str;

trait FiltersTemplates
{
/**
Expand All @@ -14,7 +16,7 @@ trait FiltersTemplates
*/
public function filterTemplateHierarchy($files)
{
return $this->sageFinder->locate($files);
return [...$this->sageFinder->locate($files), ...$files];
}

/**
Expand All @@ -27,6 +29,10 @@ public function filterTemplateHierarchy($files)
*/
public function filterTemplateInclude($file)
{
if (@file_exists($file) && ! Str::endsWith($file, '.blade.php')) {
return $file;
}

$view = $this->fileFinder
->getPossibleViewNameFromPath($file = realpath($file));

Expand Down
Loading