Skip to content

Commit a709c26

Browse files
authored
[9.x] add optional verbose output when view caching (#44673)
* add optional verbose output when view caching - you can pass `-v` to see the directories the command is looking in - you can pass `-vv` to also see every file the command is caching * minor formatting
1 parent 15ce569 commit a709c26

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Illuminate/Foundation/Console/ViewCacheCommand.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Illuminate\Console\Command;
66
use Illuminate\Support\Collection;
77
use Symfony\Component\Console\Attribute\AsCommand;
8+
use Symfony\Component\Console\Output\OutputInterface;
89
use Symfony\Component\Finder\Finder;
910
use Symfony\Component\Finder\SplFileInfo;
1011

@@ -46,9 +47,15 @@ public function handle()
4647
$this->callSilent('view:clear');
4748

4849
$this->paths()->each(function ($path) {
50+
$prefix = $this->output->isVeryVerbose() ? '<fg=yellow;options=bold>DIR</> ' : '';
51+
52+
$this->components->task($prefix.$path, null, OutputInterface::VERBOSITY_VERBOSE);
53+
4954
$this->compileViews($this->bladeFilesIn([$path]));
5055
});
5156

57+
$this->newLine();
58+
5259
$this->components->info('Blade templates cached successfully.');
5360
}
5461

@@ -63,8 +70,14 @@ protected function compileViews(Collection $views)
6370
$compiler = $this->laravel['view']->getEngineResolver()->resolve('blade')->getCompiler();
6471

6572
$views->map(function (SplFileInfo $file) use ($compiler) {
73+
$this->components->task(' '.$file->getRelativePathname(), null, OutputInterface::VERBOSITY_VERY_VERBOSE);
74+
6675
$compiler->compile($file->getRealPath());
6776
});
77+
78+
if ($this->output->isVeryVerbose()) {
79+
$this->newLine();
80+
}
6881
}
6982

7083
/**

0 commit comments

Comments
 (0)