Skip to content

⚡ Bolt: [performance improvement] Preload LCP and Preconnect Fonts#37

Open
Mitesh411 wants to merge 1 commit into
masterfrom
bolt-performance-optimizations-11985127944048036046
Open

⚡ Bolt: [performance improvement] Preload LCP and Preconnect Fonts#37
Mitesh411 wants to merge 1 commit into
masterfrom
bolt-performance-optimizations-11985127944048036046

Conversation

@Mitesh411

Copy link
Copy Markdown
Owner

💡 What:

  • Added <link rel="preload" as="image" href="assets/img/hero-bg.jpg"> to index.html.
  • Added <link rel="preconnect" href="https://fonts.googleapis.com"> and <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> to both index.html and portfolio-details.html.

🎯 Why:

  • The hero-bg.jpg is the Largest Contentful Paint (LCP) element on the homepage. Preloading it ensures the browser starts fetching it immediately, rather than waiting to discover it in the CSS file.
  • Preconnecting to Google Fonts domains establishes the early DNS resolution, TCP handshake, and TLS negotiation, significantly reducing the latency for fetching font stylesheets and font files.

📊 Impact:

  • Faster LCP time for index.html as the main hero image is fetched earlier.
  • Faster font rendering times across both pages, reducing potential FOIT (Flash of Invisible Text) or FOUT (Flash of Unstyled Text).

🔬 Measurement:

  • Run a Lighthouse performance audit or use WebPageTest before and after the change to observe improvements in the Largest Contentful Paint (LCP) and First Contentful Paint (FCP) metrics. You can also inspect the Network tab in DevTools to see the connection setup times for the font requests and the earlier request initiation for hero-bg.jpg.

PR created automatically by Jules for task 11985127944048036046 started by @Mitesh411

* Preloaded the LCP hero background image (`assets/img/hero-bg.jpg`) in `index.html`.
* Added `preconnect` resource hints for Google Fonts (`fonts.googleapis.com` and `fonts.gstatic.com`) in both `index.html` and `portfolio-details.html`.

Co-authored-by: Mitesh411 <6998472+Mitesh411@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 24ec56dca1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread index.html
Comment on lines +38 to +39
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow font origins in CSP before adding preconnect

These new preconnect hints are ineffective on index.html because the page’s CSP is default-src 'self' (line 61), so cross-origin connections to fonts.googleapis.com/fonts.gstatic.com are blocked by policy fallback. In this context, the added links do not provide the intended latency win and instead add extra CSP violation noise on every page load; update CSP (for example via connect-src) alongside this optimization.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant