@jonatangroncode/jsview
v0.1.3
Published
Run JavaScript files and view output in your browser
Maintainers
Readme
jsview
Run a JavaScript file and instantly preview the result in your browser with automatic reload.
jsview is a lightweight CLI tool that starts a local server, opens your browser, and reloads the page whenever your JavaScript file is saved.
Perfect for quickly testing small scripts without setting up a full project or dev server.
Installation
Install globally with npm:
npm install -g jsviewUsage
Run a JavaScript file and open it in your default browser:
jsview test.jsThe browser will open automatically and reload whenever the file is saved.
Split Preview Mode (macOS)
You can open a split preview in Safari using:
jsview-p test.jsThis will:
- start the local server
- open Safari
- position the browser window on the right half of the screen
- reload automatically when the file changes
Note: jsview-p currently supports macOS + Safari.
Example
Example test.js:
document.body.innerHTML = "<h1>Hello jsview</h1>";Run:
jsview test.jsEdit the file and save — the browser will reload automatically.
How it works
jsview:
- Starts a small local server
- Generates an HTML page that runs your script
- Opens the page in your browser
- Watches the file for changes
- Reloads the browser using WebSockets when the file is saved
Commands
| Command | Description |
|--------|-------------|
| jsview <file> | Run a JavaScript file and preview in the default browser |
| jsview-p <file> | Run the file and open Safari in split preview mode |
Tips
For the best experience enable Auto Save in your editor so the page reloads automatically while you work.
Example in VS Code:
Settings → Files → Auto Save → After Delay
Requirements
- Node.js 18+
- macOS (for
jsview-psplit preview)
License
MIT
