JSPM

  • Created
  • Published
  • Downloads 135
  • Score
    100M100P100Q76784F
  • 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 open url of server by platform default program.
--execute, -e <param> execute command when the server has prepared.
--stop-on-exit false exit when invoked process specified by '--execute' died.
--watch, -w <param> /^/ regex pattern for file to watch.
--watch-delay <param> 1 delay the watch event to supress duplication (in ms).
--verbose, -v false enable verbose logging.
--client-log false inform client to log.
--recursive, -r true watch sub-directories 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 the whole page.
--broadcast-delay <param> 0 delay time before broadcasting event (in ms).
--no-default-script false disable default script injection.
--inject-file, -I <param> the file to be injected into content.
--inject-method, -M <param> p specify the injection method [prepend or append]
--inject-match-text, -T <param> specify the regex or string pattern for content where to inject
--inject-match-file, -F <param> specify the regex pattern for file where 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.22-0

Installation

install this package via 'npm'.

npm install simple-autoreload-server

License

MIT