JS Live Preview
HTML, CSS & JavaScript Live Web Preview with In-Editor DevTools
JS Live Preview provides a fast, zero-config web development environment right inside Visual Studio Code. Edit your HTML, CSS, JavaScript, TypeScript, or React/Vite code and see changes update in real time with an integrated browser DevTools console, interactive DOM & CSS Box Model inspector, responsive device modes, test credential autofill, and session preservation across saves.
⚡ Core Features
Say goodbye to opening external browser developer tools just to read console.log output.
- Real-Time Log Capture: Intercepts
console.log, console.info, console.warn, console.error, console.table, and console.dir.
- Expandable Object & Array Tree: Interactive tree viewer for complex nested JavaScript objects and arrays (
{ id: 1042, user: "Alex", ... }).
- Clickable Source File Navigation: Stack traces and error messages link directly to the exact file and line number in your editor (
app.js:14).
- Level Filters & Counters: Quickly filter by All, Log, Warn, Error, and Info with real-time badge counts.
- Browser-Grade Settings Gear (⚙️): Toggle options like Hide network, Preserve log, Show timestamps, and view the dynamic N hidden badge.
- Live Interactive REPL: Execute JavaScript expressions directly against the running preview context.
🔍 2. Interactive DOM Tree & Chrome-Style Element Inspector
Inspect and live-edit UI elements without leaving VS Code.
- Interactive Expandable DOM Tree: Full DOM hierarchy with syntax-highlighted HTML tags, attributes, collapsible subtrees, and instant search filtering.
- Chrome-Style Hover-to-Inspect: Click Select element (or press
Ctrl+Shift+C / Cmd+Shift+C) and hover over preview elements to see 4-layer box model overlays (Margin: orange, Border: yellow, Padding: green, Content: blue) and dimension badges.
- Real-Time Live Mutation Sync: DOM updates, additions, and deletions from JavaScript scripts sync automatically into the tree via
MutationObserver (no manual refresh needed).
- Visual Box Model Diagram: Color-coded diagram showing live computed Margin, Border, Padding, and Content (W × H) dimensions.
- Live CSS Property Editor: Edit CSS properties inline with real-time visual feedback in the preview.
- Breadcrumb Navigation & 1-Click Copy: Click breadcrumbs to navigate parent hierarchies, and copy CSS rules or unique selectors with one click.
🔄 3. Instant Live Reload & Session Preservation
- Zero-Flicker Reloads: Dark theme tokens eliminate annoying white screen blinks during reloads.
- Hot CSS Reload: Modifying stylesheets injects changes immediately without resetting your JavaScript state or page scroll.
- Preserve Active Route & Auth State: Keeps
sessionStorage, localStorage, document.cookie, and sub-routes (e.g. /contact.jsx stays on /contact) intact when saving files.
📱 4. Responsive Device Viewports & Dark Mode Emulation
- 1-Click Viewport Presets: Switch instantly between Desktop (fluid), Tablet (768×1024), and Mobile (375×667), or enter custom dimensions.
- Theme & Color Scheme Emulation (🌓): Cycle through Auto, Light (☀️), and Dark (🌙) modes with real
@media (prefers-color-scheme) emulation.
🔑 5. Smart Test Credential Autofill
- Instant Test Accounts: Click 🔑 Autofill to populate test forms with pre-configured accounts (Admin, Dev, Test User).
- Paired Password Filling: Automatically fills corresponding password fields in login and signup forms.
- Framework Compatible: Dispatches native input events for smooth integration with React, Vue, Svelte, and vanilla forms.
- Vanilla & Modern Toolchains: Zero-config support for plain HTML/JS/CSS, TypeScript (
.ts), React/JSX (.jsx, .tsx), Angular, and Vite.
- Native Dev Server Integration: Automatically detects package managers (
npm, pnpm, yarn, bun) and runs the project's native dev scripts.
🚀 Getting Started
- Open any
.html, .css, .js, .ts, or .jsx file in VS Code.
- Launch the preview using any of the following:
- Click the Live Preview icon in the editor tab bar.
- Press
Ctrl+Shift+Z / Ctrl+Shift+J (Windows/Linux) or Cmd+Shift+Z / Cmd+Shift+J (macOS).
- Right-click inside your editor and select Live Preview: Open.
- Edit your code and save (
Ctrl+S / Cmd+S) to see real-time updates and console output!
⌨️ Keyboard Shortcuts
| Command |
Windows / Linux |
macOS |
| Open Live Preview |
Ctrl + Shift + Z |
Cmd + Shift + Z |
| Open Live Preview & Focus Console |
Ctrl + Shift + J |
Cmd + Shift + J |
📋 Available Commands
Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and type Live Preview:
| Command |
Description |
Live Preview: Open |
Open live preview for active file or project |
Live Preview: Open in External Browser |
Open preview in default browser |
Live Preview: Refresh Preview |
Force reload active preview |
Live Preview: Clear Console |
Clear all logs from DevTools console |
Live Preview: Start Project Server |
Start framework dev server (dev, start) |
Live Preview: Stop Project Server |
Stop running framework dev server |
Live Preview: Restart Project Server |
Restart project dev server process |
Live Preview: Send REST API Request |
Open integrated REST API client |
⚙️ Configuration Settings
Customize behavior in VS Code Settings (Ctrl+, / Cmd+, search jsLivePreview):
| Setting |
Type |
Default |
Description |
jsLivePreview.openLocation |
string |
"sideBySide" |
Display as split editor panel ("sideBySide") or external window ("externalBrowser"). |
jsLivePreview.externalBrowserApp |
string |
"default" |
Browser for external preview ("default", "chrome", "firefox", "edge"). |
jsLivePreview.watchdogWarnSeconds |
number |
5 |
Threshold in seconds before warning of slow scripts. |
jsLivePreview.watchdogKillSeconds |
number |
15 |
Threshold in seconds before stopping runaway infinite loops. |
🛡️ Privacy & Security
- Local-Only: Binds exclusively to
127.0.0.1.
- Protected Environment: Denies directory traversal and blocks access to sensitive workspace files (
.env, .git, certificates, secrets).
- Zero Telemetry: No analytics or remote telemetry tracking.
Enjoying JS Live Preview? Leave a ⭐ on GitHub and rate us on the VS Code Marketplace!
| |