2.5k
GitHub Stars
2
Bundled Files
2 months ago
Catalog Refreshed
3 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill openclaw/skills --skill static-server- _meta.json286 B
- SKILL.md1.9 KB
Overview
This skill starts a lightweight local HTTP server to preview static HTML pages in a browser. It provides a localhost URL so browser tools and automation can access files that would otherwise be blocked by file:// restrictions. Use it to quickly serve a single HTML file or an entire directory for testing and screenshots.
How this skill works
The bundled Python script launches a simple HTTP server that serves either the parent directory of a specified file or a provided directory path. It prints the access URL, the directory being served, and instructions to stop the server. You can run it in the foreground or start it in background mode for automated test workflows. A one-liner using python -m http.server is also supported for quick directory serving.
When to use it
- Testing static HTML pages locally before deployment
- Previewing pages when browser tools block the file:// protocol
- Providing a localhost URL for browser automation or screenshots
- Quickly sharing a local page with teammates on the same machine
- When you need a reproducible, scriptable local server for CI or manual testing
Best practices
- Serve the directory rather than a file if your page loads relative assets (CSS, JS, images).
- Pick a non-conflicting port via --port when multiple services run on your machine.
- Run the server in background mode for automated browser tests and ensure you kill the process after tests.
- Use the printed access URL (http://localhost:PORT/filename.html) to avoid path errors in browser tooling.
- Prefer the bundled script to target a specific file; use python -m http.server for fast, root-level directory serves.
Example use cases
- Run python scripts/serve.py /path/to/index.html to serve a single HTML file with asset resolution from its parent folder.
- Start in background for test automation, open the localhost URL in a headless browser, capture screenshots, then kill the server process.
- Serve a project directory during manual QA to validate responsive layouts and resource loading.
- Use a custom port (e.g., --port 9000) when 8000 is already in use or when running parallel test instances.
FAQ
Yes. Point the script at a file path; it serves the file's parent directory and prints the direct URL to that file.
What if port 8000 is already in use?
Specify another port with --port PORT or run python -m http.server with a custom port to avoid conflicts.