{{-- One showcase example: the Blade in `code`, rendered, with the source beside it — one string, so what is shown and what is written can never disagree. --}} @props(['title' => null, 'code', 'stack' => false]) @php // Written as an application without a prefix writes it; under a configured prefix the tags are // rewritten to it, so what renders and what is shown is what this application would write. $prefix = config('livewire-material.prefix'); if (filled($prefix)) { $names = collect(glob(\NoNameWeb\LivewireMaterial\LivewireMaterialServiceProvider::componentPath().'/*.blade.php')) ->map(fn (string $path): string => preg_quote(basename($path, '.blade.php'), '/')) ->sortByDesc(fn (string $name): int => strlen($name)) ->implode('|'); $code = preg_replace('/<(\/?)x-('.$names.')(?=[\s\/>])/', '<$1x-'.$prefix.'::$2', $code); } @endphp
{{ trim($code) }}