Agent Wranglers

Performance Recommended

Never let a script block the page

Load scripts as type="module" or with defer, keep blocking scripts out of the head, and send as little JavaScript as possible.

How to do it

Ship one type="module" bundle, which is deferred by default. Keep inline scripts to tiny ones that must run before paint, such as applying a saved theme. Load third-party code late, or not at all.

Example

<head>
  <script>
    try { document.documentElement.dataset.theme = localStorage.theme || ""; } catch {}
  </script>
  <script type="module" src="/app.3f9a1c.js"></script>
</head>

How to check

Total Blocking Time is near 0. Nothing blocks the parser.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/performance/script-loading.