1.0.0-beta.1 β€’ Published 3 months ago

@stexcore/live-server v1.0.0-beta.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

@stexcore/live-server

NPM Version License TypeScript

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

  1. Serve a directory (defaults to index.html if present):

    live-server ./public
  2. Serve the current directory:

    live-server .

    Or simply:

    live-server
  3. Customize the port (default: 3000):

    live-server ./public --port 8080
  4. View available commands and options:

    live-server --help
  5. Show the current version of Live Server:

    live-server --version

    Or:

    live-server -v
  6. 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

OptionDescriptionDefault
pathsOne 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, -hShow this help message.-
--version, -vShow the current version.-
--strict, -sEnforce 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.

1.0.0-beta.1

3 months ago

1.0.0-alpha.1

3 months ago