JSPM

  • Created
  • Published
  • Downloads 135
  • Score
    100M100P100Q76830F
  • License MIT

Simple Web Server with live/autoreload features without browser extensions.

Package Exports

  • simple-autoreload-server

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simple-autoreload-server) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

simple-autoreload-server Build Status

A simple Web server on Node.js with Live/Autoreload feature.

  • Reload statically on update the html files
  • Refresh dynamically on update the files like css, js, png, and etc.
  • No browser extensions are needed. (uses only WebSocket.)

Usage

  1. Install simple-autoreload-server via npm. (e.g. npm install simple-autoreload-server)

  2. Start autoreload-server from command line. (e.g. autoreload-server ./ 8080)

  3. Open server url with your browser. (e.g. iexplore http://localhost:8080/)

Command Line Usage

autoreload-server [options] [root-dir] [port]

Command Line Options

option default description
--root, -d <param> . set base directory to publish.
--port, -p <param> 8080 set port to listen (http).
--list-directory, -l true enable directory listing.
--browse, -b false browse server by default program.
--execute, -e <param> execute command when the server is ready to accept.
--stop-on-exit false stop server when process specified by '--execute' died.
--watch, -w <param> /^/ regex pattern of file to watch.
--watch-delay <param> 1 time to delay before fireing watch event (in ms).
--verbose, -v false enable verbose log.
--client-log false inform client to log.
--recursive, -r true watch directory recursively. (may take a while at startup)
--follow-symlink, -l false follow symbolic-link. (it affects only when the resursive option specified.
--force-reload, -f <param> regex pattern for file forced to reload page.
--broadcast-delay <param> 0 time to delay before broadcasting file update event (in ms).
--no-default-script false disable injection of default client script.
--inject-file, -I <param> set path to additional file to be injected.
--inject-method, -M <param> p specify the method [prepend or append]
--inject-match-text, -T <param> specify the pattern where to inject
--inject-match-file, -F <param> specify the pattern for file to inject
--version, -V show version
--help, -h show help

Example

autoreload-server -w "\\.(html|css|js)" ./site-files 8008

Module Usage (Example)

var launcher = require('simple-autoreload-server');

var server = launcher({
  port: 8008,
  root: './',
  listDirectory: true,
  watch: /\.(png|js|html|json|swf)$/i,
  forceReload: [/\.json$/i, "static.swf"]
});

Options

See 'src/lib/options.ls' for details of options.

Version

0.0.18

Installation

install this package via 'npm'.

npm install simple-autoreload-server

License

MIT