Skip to content

Commit c5da1f5

Browse files
committed
Clean up extra compiled Blade views
1 parent d2ccb35 commit c5da1f5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/BladeService.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function isolatedRender(string $template): string
1313
{
1414
$compiler = app('blade.compiler');
1515

16-
$temporaryCachePath = storage_path('framework/views/blaze/isolated-render');
16+
$temporaryCachePath = storage_path('framework/views/blaze');
1717

1818
File::ensureDirectoryExists($temporaryCachePath);
1919

@@ -44,7 +44,11 @@ function ($input) {
4444
]);
4545

4646
try {
47-
$result = $compiler->render($template);
47+
// As we are rendering a string, Blade will generate a view for the string in the cache directory
48+
// and it doesn't use the `cachePath` property. Instead it uses the config `view.compiled` path
49+
// to store the view. Hence why our `temporaryCachePath` won't clean this file up. To remove
50+
// the file, we can pass `deleteCachedView: true` to the render method...
51+
$result = $compiler->render($template, deleteCachedView: true);
4852

4953
$result = Unblaze::replaceUnblazePrecompiledDirectives($result);
5054
} finally {

0 commit comments

Comments
 (0)