tinyliveserver

1.0.1 • Public • Published

tinyliveserver

Tiny http server with live reload capability.

Installation

npm i tinyliveserver

Example

const tinyliveserver = require('tinyliveserver')
tinyliveserver.start({
  port: 1234,
  root: 'public',
  watch: 'src',
})

Configuration

const config = {
  host: '127.0.0.1', // Set the server address. Default: 0.0.0.0
  port: 3000, // Set the server port. Default: 3000
  root: 'public', // Set root directory that's being served. Default: current directory
  watch: ['dist', 'public'], // Paths to exclusively watch for changes. Default: null (disabled livereload).
  wait: 100, // Waits for all changes, before reloading. Default(ms): 100. 'watch' configuration must be filled.
  verbose: true, // Show logging. Default: true
}

tinyliveserver.start(config)

Methods

tinyliveserver.reload() // Reload manually. 'watch' configuration must be filled.
tinyliveserver.shutdown() // Stop server.

CLI

Include as npm script:

...
"scripts": {
  "serve": "tinyliveserver --port=1234 --root=public --watch=src"
}
...
npm run serve

Or using npx:

npx tinyliveserver --port=1234 --root=public --watch=src

Or install globally:

npm install tinyliveserver -g
tinyliveserver --port=1234 --root=public --watch=src

CLI parameters

--host=127.0.0.1 // Set the server address. Default: 0.0.0.0
--port=3000 // Set the server port. Default: 3000
--root=public // Set root directory that's being served. Default: current directory
--watch=dist,public // Paths to exclusively watch for changes. Default: null (disabled livereload)
--wait=100 // Waits for all changes, before reloading. Default(ms): 100. 'watch' configuration must be filled.
--quiet // Hide logging..

Package Sidebar

Install

npm i tinyliveserver

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

7.33 kB

Total Files

6

Last publish

Collaborators

  • jarstone