@stexcore/live-server v1.0.0-beta.1
@stexcore/live-server
Live Server is a CLI tool designed to streamline local development by enabling real-time updates and quick testing of static files with minimal setup.
π Features
- Real-Time Updates: Automatically refreshes the browser whenever files change to ensure youβre always viewing the latest version.
- Quick Server Initialization: Start serving your files instantly from the command line.
- Multi-Directory Support: Serve static files from multiple directories seamlessly.
- Automatic File Detection: Handles common scenarios like missing
index.html
files gracefully. - Dynamic Browser Interaction: Injects functionality into served files for enhanced debugging and development convenience.
π οΈ Installation
To use Live Server, install it globally via npm:
npm install -g @stexcore/live-server
π Usage
Start a development server from the command line:
live-server \[paths...\] \[options\]
Examples
Serve a directory (defaults to
index.html
if present):live-server ./public
Serve the current directory:
live-server .
Or simply:
live-server
Customize the port (default: 3000):
live-server ./public --port 8080
View available commands and options:
live-server --help
Show the current version of Live Server:
live-server --version
Or:
live-server -v
Enable strict mode (enforce exact matching of paths):
live-server ./public --strict
Or:
live-server ./public -s
Real-Time Functionality
Live Server makes development seamless by providing:
- Automatic Refresh: Detects changes in your project and instantly refreshes the browser.
- Robust Connectivity: Keeps the client connected to the server, ensuring uninterrupted updates.
Directory Structure
The CLI expects a directory or file path to serve. Example:
project-root/
βββ public/
β βββ index.html
β βββ styles.css
β βββ app.js
β βββ images/
β β βββ logo.png
β β βββ banner.jpg
Available CLI Options
Option | Description | Default |
---|---|---|
paths | One or more directories or files to serve. | Current working directory |
--port=<number> | Specify the port for the server. | 3000 |
-p <number> | Alias for --port . | - |
--help, -h | Show this help message. | - |
--version, -v | Show the current version. | - |
--strict, -s | Enforce exact matching between the requested path and filename. | false |
π€ Contributing
We welcome contributions to improve Live Server! If you find bugs, want to propose new features, or enhance the CLI experience, feel free to open an issue or submit a pull request.
π License
This project is licensed under the MIT License.
β¨ Author
Developed with β€οΈ by Stexcore.
3 months ago
3 months ago