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 
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
Install simple-autoreload-server via npm. (e.g. npm install simple-autoreload-server)
Start autoreload-server from command line. (e.g. autoreload-server -d ./ -p 8080)
Open server url with your browser. (e.g. iexplore http://localhost:8080/)
Command Line Usage
autoreload-server [options] [root-dir] [port]
Overview of Command Line Options
option | default | help |
---|---|---|
--path, -d |
. |
set directory to publish. |
--watch, -w |
**/** |
pattern for file to watch. |
--reload, -r |
false |
pattern for file to reload the whole page. |
--mount.path, -m |
. |
set additional directory to publish. |
--mount.target, -t |
/ |
server side path of mounted direcory |
--mount.watch, -W |
**/** |
pattern of file to watch. |
--host, -H |
0.0.0.0 |
set host address to publish. |
--port, -p |
8080 |
set port to listen (http). |
--config, -c |
.autoreload.json |
load options from json. |
--search-config |
true |
search for config json in parent directories. |
--list-directory, -l |
true |
enable directory listing. |
--browse, -b |
false |
open server url by platform default program. |
--execute, -e |
`` | execute command when the server has prepared. |
--stop-on-exit, -k |
false |
exit when invoked process specified by "execute" died. |
--ignore-case, -i |
true |
ignore case of glob patterns. |
--include-hidden, -n |
false |
glob includes hidden files. |
--default-pages |
index.{htm,html} |
default page file pattern for directory request. |
--encoding |
utf-8 |
encoding for reading texts and inject target files |
--watch-delay |
20 |
delay time to supress duplicate watch event (in ms). |
--verbose, -v |
false |
enable verbose logging. |
--silent |
false |
disable server logging. |
--builtin-script |
true |
enable default built-in script injection. |
--client-module |
true |
expose client module to 'window' object. |
--client-log |
false |
inform client to log. |
--recursive, -R |
true |
watch sub-directories recursively. (may take a while at startup) |
--follow-symlinks, -L |
false |
follow symbolic-links. (it affects only when the resursive option specified.) |
--inject.content, -I |
`` | injects specified content. |
--inject.type, -T |
file |
type of "inject.content". |
--inject.which, -F |
**/**.{php,htm,html,cgi,pl,rb} |
specify pattern for injection target. |
--inject.where, -P |
`</(body | head |
--inject.prepend, -E |
false |
insert content before matched. |
--help, -h |
false |
show help |
--version, -V |
false |
show version |
Example
autoreload-server -w "**/**.{html,css,js}" ./site-files 8008
Module Usage (Example)
var launcher = require('simple-autoreload-server');
var server = launcher({
port: 8008,
path: './',
listDirectory: true,
watch: "*.{png,js,html,json,swf}"
reload: "{*.json,static.swf}"
});
Client Module Usage
See examples, and "src/client.ls" for details.
Options
See Options.md for details.
Version
0.1.4
Installation
install this package via 'npm'.
npm install simple-autoreload-server
License
MIT