A server which detect the file change and reload the resource at client side automatically
A server which detect the file change and reload the resource at client side automatically, could be also used as a connect middleware for file watching and livereload server with snippet contains script tag injected on the fly.
$ npm install -g liveload
Need to install some sofeware to support the notification, refer to https://github.com/visionmedia/node-growl
Goto the directory you want to serve, and type:
And enjoy live edit of css/js/html files.
var connect =http =liveload = ;var app = ;var root = process;app;http;
rootroot directory for watching files, could be array of directory path, this is required
filesregexp for watching files eg:
excludeexcludes regex used for exclude folders
injectboolean value indicate whether to inject the script element on the fly, default
portport number for the livereload server, default
Nodejs would report an error if there's too many files for watching due to system limitation, on Linux you can change that by adding
fs.inotify.max_user_watches = 524288 to the file
etc/sysctl.conf and restart the process by command:
sudo sysctl -p