A simple Express.js server for previewing HTML files locally.
- Preview any HTML file on your local machine
- Automatic port scanning (3000-9000)
- Clean error handling
- Simple command-line interface
- Global command availability via npm
Install the package globally:
npm install -g dev-previewRun the server with:
dev-preview --show <your-html-file>Example:
dev-preview --show hello.htmlCheck the installed version:
dev-preview --versionThe server will automatically try ports 3000-9000 if the default port is in use.
Only HTML files are supported. The server will exit with an error if you try to serve a non-HTML file.
The server will automatically find an available port and start serving your file.
Dev Preview/
├── app.js # Main server file
Test/
├── hello.html # Example HTML file
└── my.html # Another example HTML file
├── test.html
├── style.css
- Shows clear error messages if file not found
- Automatically tries next port if current port is in use
- Proper error handling for server startup failures
- Node.js (latest LTS version recommended)
- npm (comes with Node.js)
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the ISC License - see the LICENSE file for details
For any issues or questions, please:
- Check the existing issues
- Create a new issue if your problem hasn't been reported yet
- Include as much detail as possible when reporting issues
- Thanks to the Express.js team for their excellent framework
- Appreciation to all contributors who help improve this package