Skip to content

Latest commit

History

History
31 lines (21 loc) 路 701 Bytes

README.md

File metadata and controls

31 lines (21 loc) 路 701 Bytes

Serve

Tiny live-reloading HTTP server. Alternative to live-server and browser-sync without all of the features/dependencies.

Reloads the page after any changes in the served directory, through a snippet of code injected into all served HTML files.

CLI Usage

# start a server in the current dir
serve

# start a server in a specific dir
serve ./dist

# run directly from npm
npx @danprince/serve ./dist

Programmatic Usage

import { createLiveReloadServer } from "@danprince/serve";

createLiveReloadServer({
  dir: "./dist",
  port: 8080,
});

See src/cli.ts for a more comprehensive example.