PluginProbe
WindPress – Tailwind CSS integration for WordPress / 3.2.89
WindPress – Tailwind CSS integration for WordPress v3.2.89
3.2.89 3.2.88 3.2.87 3.2.86 3.2.85 3.2.84 3.2.83 3.2.82 3.2.81 trunk 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 All 143 releases
← All changes | src/Integration/Timber/Compile.php +13 -14 3.2.883.2.89 View file →
@@ -13,8 +13,9 @@
13 13
14 14 use WindPressDeps\Symfony\Component\Finder\Finder;
15 15 use Timber\LocationManager;
16 16 use Timber\Timber;
17 +use WindPress\WindPress\Core\Scanner\FileScanner;
17 18 /**
18 19 * @author Joshua Gugun Siagian <suabahasa@gmail.com>
19 20 */
20 21 class Compile
@@ -30,21 +31,19 @@
30 31 return $this->get_contents($metadata);
31 32 }
32 33 public function get_contents($metadata): array
33 34 {
34 - $contents = [];
35 - $paths = LocationManager::get_locations();
36 - $paths = array_unique(array_filter(array_merge(...array_values($paths)), fn($path) => $path !== '/'));
37 - $finder = new Finder();
38 - $finder->in($paths);
39 - $finder->files()->name('*.twig');
40 - do_action('a!windpress/integration/timber/compile:get_contents.finder', $finder);
41 - foreach ($finder as $file) {
42 - $template_file = $file->getPathname();
43 - if (!is_readable($template_file)) {
44 - continue;
35 + return FileScanner::scan_files('timber', static function (): \Generator {
36 + $paths = LocationManager::get_locations();
37 + $paths = array_unique(array_filter(array_merge(...array_values($paths)), static fn($path) => is_string($path) && $path !== '/' && is_dir($path)));
38 + if ($paths === []) {
39 + return;
45 40 }
46 - $contents[] = ['name' => $file->getRelativePathname(), 'content' => $file->getContents()];
47 - }
48 - return ['metadata' => ['next_batch' => \false, 'total_batches' => 1], 'contents' => $contents];
41 + $finder = new Finder();
42 + $finder->in($paths)->files()->name('*.twig');
43 + do_action('a!windpress/integration/timber/compile:get_contents.finder', $finder);
44 + foreach ($finder as $file) {
45 + yield ['path' => $file->getPathname(), 'name' => $file->getRelativePathname()];
46 + }
47 + }, $metadata['next_batch'] ?? \false);
49 48 }
50 49 }