Get AI summaries of any video or article — Sign up free
Build Anything with Perplexity, Here’s How thumbnail

Build Anything with Perplexity, Here’s How

David Ondrej·
5 min read

Based on David Ondrej's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Use Perplexity to generate the initial Chrome extension files (manifest.json, popup HTML, JavaScript, CSS) and even the required icon assets, then iterate from there.

Briefing

A beginner-friendly workflow for building a Chrome extension is the headline: Perplexity is used to generate the extension’s code (manifest, popup UI, JavaScript behavior, and CSS), then iterative fixes are made—ultimately switching to GPT-4 for debugging—to create a “focus” tool that blocks distracting sites and forces a choice between continuing or redirecting to a task list. The practical payoff is immediate: after multiple rounds of troubleshooting, the extension can intercept visits to Twitter/X and present a full-screen overlay with two options, effectively turning web browsing into a controlled decision point.

The build starts with Perplexity’s ability to search the web and also generate code from that context. The creator contrasts Perplexity with ChatGPT by pointing out that Perplexity pulls from many more sources (e.g., “20 different websites” versus fewer sources in another tool), and highlights the ability to choose models—specifically Claude 3 Opus—for code generation, then switch to GPT-4 for debugging. That model-switching becomes a key tactic when the extension doesn’t behave as expected.

The extension concept is straightforward: when a user tries to visit a distracting domain (initially Twitter, later updated for x.com as well), a UI appears offering two buttons—one to redirect to a task list URL (the example uses Todoist) and another to continue to the original site. Perplexity also helps generate multiple UI design options (popup, sidebar, full-page interstitial), but the final implementation converges on a full-screen overlay that prevents the site from loading normally.

From there, the workflow becomes a step-by-step coding exercise without manual coding knowledge. The creator creates a project folder in VS Code, adds a manifest.json, then generates popup HTML, JavaScript, and CSS. Icons are also generated with Perplexity and then resized into the required PNG dimensions for Chrome’s extension manifest. Testing follows Chrome’s standard “developer mode” and “load unpacked” process, with the extension initially failing to trigger the overlay automatically.

Troubleshooting is the turning point. The extension works only after clicking the extension icon, which reveals an injection/overlay timing problem—content scripts weren’t producing the intended full-screen block during page load. The fix involves restructuring the extension so the overlay is injected as a content script and displayed immediately when visiting twitter.com or x.com. After that change, the overlay finally blocks the distraction flow: the user can still scroll in the background, but the full-screen UI appears with the choice buttons.

The last polish is visual: the overlay background is changed from a dimmed opacity effect to a fully black screen, making the distraction harder to ignore. The result is a working focus extension built in under an hour despite starting as a “complete beginner,” reinforced by the broader message that AI tools can handle the coding and debugging loop—especially when switching models for different tasks (code generation vs. debugging).

Cornell Notes

Perplexity can generate the full codebase for a Chrome “focus” extension—manifest.json, popup HTML, JavaScript, CSS, and even extension icons—so a non-programmer can build something functional. The extension’s job is to intercept visits to distracting sites (Twitter/X) and show a full-screen overlay with two actions: redirect to a task list or allow continuing to the site. Early versions may only work after clicking the extension icon, which points to content-script injection/timing issues. Switching to GPT-4 for debugging helps correct the manifest/content-script setup so the overlay appears automatically on twitter.com and x.com. The final refinement makes the overlay background fully black for stronger focus.

What is the core behavior the extension implements when a user visits a distracting site?

It intercepts navigation to twitter.com and x.com and displays an overlay with two buttons. One button redirects the browser to a task list URL (the example uses Todoist), while the other button lets the user continue to the original distracting site. The JavaScript logic is updated so the “productive” option replaces the current tab’s URL rather than opening a new tab, and the “continue” option allows the original site to load.

Why does the build require multiple iterations instead of working on the first try?

The first working version often appears only after manually clicking the extension icon, which indicates the overlay isn’t being injected at the right time or in the right way. That behavior suggests a content-script/injection issue: the overlay UI isn’t reliably displayed during page load. The debugging loop involves adjusting the manifest and script structure so the overlay is injected automatically when the URL matches twitter.com or x.com.

How do model choices affect the workflow (Perplexity vs GPT-4)?

Perplexity is used to generate the initial code quickly (including HTML/CSS/JS scaffolding and manifest structure). When debugging becomes necessary—especially for tricky Chrome extension behavior—GPT-4 is used to diagnose and correct the code. The creator frames this as a practical division of labor: Perplexity for building, GPT-4 for debugging.

What role does the Chrome extension manifest play in making the overlay appear correctly?

The manifest defines permissions, host permissions, and—critically—how scripts are attached to pages. The extension initially fails to block automatically because the content-script setup doesn’t trigger the overlay during navigation. Updating the manifest to include the correct content script (and related files) is what ultimately makes the overlay appear immediately when visiting twitter.com or x.com.

How does the extension ensure it targets only specific sites (Twitter/X) rather than everything?

The JavaScript checks the current tab URL and only shows the overlay or performs the redirect when the URL matches twitter.com or x.com. This prevents the extension from interfering with unrelated browsing and keeps the focus behavior scoped to the intended domains.

What final UI change improves the “focus” effect?

The overlay background is changed from a dimmed/opacity approach to a fully black background. That makes the distracting content less visible while the overlay is active, strengthening the practical goal of reducing time-wasting.

Review Questions

  1. What specific Chrome extension mechanism must be corrected when the overlay only appears after clicking the extension icon?
  2. How would you modify the URL-matching logic to support an additional distracting domain beyond twitter.com and x.com?
  3. Why might redirecting the current tab (instead of opening a new tab) be important for a productivity-focused extension?

Key Points

  1. 1

    Use Perplexity to generate the initial Chrome extension files (manifest.json, popup HTML, JavaScript, CSS) and even the required icon assets, then iterate from there.

  2. 2

    Design the extension around a simple decision UI: redirect to a task list or allow continuing to the distracting site.

  3. 3

    Test via Chrome’s developer mode and “load unpacked,” then validate behavior on the exact target domains (twitter.com and x.com).

  4. 4

    If the overlay appears only after clicking the extension icon, treat it as an injection/timing problem and adjust the manifest/content-script setup.

  5. 5

    Switch to GPT-4 for debugging when extension behavior doesn’t match expectations, especially for content-script overlay rendering.

  6. 6

    Scope the extension with URL checks so it only triggers on the intended distracting sites.

  7. 7

    Polish the overlay for usability—e.g., use a fully black background to reduce visibility of distracting content.

Highlights

Perplexity can generate a complete Chrome extension codebase for a non-programmer, including manifest, UI, behavior, and icons.
The extension’s breakthrough comes from fixing content-script injection so the overlay appears automatically on twitter.com and x.com.
Model switching matters: Perplexity accelerates code generation, while GPT-4 helps debug Chrome extension behavior that won’t trigger correctly.
A small UI tweak—switching to a fully black overlay—makes the focus effect more effective in practice.

Topics

  • Chrome Extension Build
  • Perplexity Code Generation
  • Content Script Debugging
  • Productivity Redirect
  • Twitter/X Focus Overlay

Mentioned