Skip to content

Commit

Permalink
Tweaks in the code examples of the controller early hints
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Apr 17, 2023
1 parent c2cdd5e commit 813398d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,12 @@ method::
public function index(): Response
{
$response = $this->sendEarlyHints([
new Link(rel: 'preconnect', href: 'https://fonts.google.com'),
(new Link(href: '/style.css'))->withAttribute('as', 'stylesheet'),
(new Link(href: '/script.js'))->withAttribute('as', 'script'),
]);

// Do something slow...
// prepare the contents of the response...

return $this->render('homepage/index.html.twig', response: $response);
}
Expand Down

0 comments on commit 813398d

Please sign in to comment.