http://localhost.
Usage
Flags
—open / —no-open
Control whether to automatically open the viewer in your default browser.--open (browser opens automatically)
—port
Specify the HTTP server port.4173
If the default port is unavailable, the viewer automatically tries the next 30 ports.
—root
Specify a custom root directory for HTML files.entries/ directory in the current workspace.
Features
File picker interface
The viewer landing page displays:- Recent files - Previously opened HTML files (with “Clear recents” button)
- Output files - All HTML files discovered in allowed output directories
URL rewriting
The viewer rewrites production URLs in HTML to local paths:https://dexdsl.github.io/assets/→/assets/https://dexdsl.org/css/→/css/https://dexdsl.com/static/→/static/
Static asset serving
The viewer serves local assets from:/assets/→public/assets/,assets/, ordocs/assets//css/→public/css/,css/, ordocs/css//static/→public/static/,static/, ordocs/static//data/→public/data/,data/, ordocs/data/
Recent files tracking
Recent files are stored in~/.config/dexdsl/recents.json and automatically pruned to the 250 most recent entries.
API endpoints
The viewer exposes internal JSON endpoints:GET /api/recent- List recent HTML filesPOST /api/recent/clear- Clear recent files historyGET /api/list- List all HTML files in allowed roots
View routes
Landing page
View file
Relative assets
Security model
The viewer enforces path safety:- Only serves files within allowed roots or recent files list
- Blocks path traversal attempts (
../) - Rejects absolute paths in relative asset requests
- HTML files must have
.htmlextension
Examples
Start viewer with default settings
http://localhost:4173/ in your browser.
Start viewer without opening browser
http://localhost:4173/.
Use custom port
Specify custom root directory
./entries/.
Allowed output directories
By default, the viewer auto-discovers HTML files in:entries/(site repo)- Any directory specified with
--root
Troubleshooting
Port already in use
The viewer automatically tries the next 30 ports starting from the requested port. If all ports are occupied:Assets not loading
Verify local asset directories exist:File not appearing in picker
Ensure the file:- Has
.htmlextension - Is inside an allowed output directory (
entries/or--root) - Is not in a hidden directory (starts with
.)
Viewer chrome template
The viewer injects a hint into served HTML:docs/index.htmlindex.htmldocs/entry/settings/index.htmlentry-template/index.html
/__dx/chrome-template.
Platform support
Browser auto-open uses:- macOS:
open <url> - Windows:
cmd /c start "" <url> - Linux:
xdg-open <url>
Related commands
dex init
Generate new entry HTML files
dex doctor
Scan and repair entry HTML