option('type') == 'local') { $includes = ''; $directoryIterator = false; try { $directoryIterator = new \RecursiveDirectoryIterator(public_path('react/v'.config('ninja.app_version').'/'), \RecursiveDirectoryIterator::SKIP_DOTS); } catch (\Exception $e) { $this->error('React files not found'); return; } foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) { if ($file->getExtension() == 'js') { if (str_contains($file->getFileName(), 'index-')) { $includes .= ''."\n"; } else { $includes .= ''."\n"; } } if (str_contains($file->getFileName(), '.css')) { $includes .= ''."\n"; } } file_put_contents(resource_path('views/react/head.blade.php'), $includes); } } }