Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
gwleuverink committed Aug 16, 2024
1 parent d7145dd commit 1111cc3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/InjectAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ public function __invoke(RequestHandled $handled)
}

/** Injects assets into given html string (taken from Livewire's injection mechanism) */
protected function injectAssets(string $html, string $core): string
protected function injectAssets(string $html, string $assets): string
{
$html = str($html);

if ($html->test('/<\s*\/\s*head\s*>/i')) {
return $html
->replaceMatches('/(<\s*\\s*head\s*>)/i', '$1' . $core)
->replaceMatches('/(<\s*\\s*head\s*>)/i', '$1' . $assets)
->toString();
}

return $html
->replaceMatches('/(<\s*html(?:\s[^>])*>)/i', '$1' . $core)
->replaceMatches('/(<\s*html(?:\s[^>])*>)/i', '$1' . $assets)
->toString();
}
}

0 comments on commit 1111cc3

Please sign in to comment.