Pavane
LiveReload Server
Install
$ npm i pavane -D # CLI $ npm i pavane -g
Usage
server
const join extname = const Pavane = /* watch path file, dir, glob, or array default: process.cwd()*/const watches = /* server static files path default: process.cwd()*/const publics = __dirname const server = watches publics // add subscribeserver { const event // watch files change event path // changed file path port // server port clients // current clients number status // server status, `stop`, `start`, `running` trigger // trigger clients reload `css` or `page` } = args const log = globalconsole if status === 'start' return if status === 'running' return if event if ... // custom return if === '.css' // reload style else // reload page return // current clients number} serverstart2222 // default 2333 server // close server
client
// by default, browser subscribes for server socket messafes and automatically refreshes `style` or `page`// but you can custom subscribes// set scripts after `<head></head>` tag window__PAVANE__ { console // server socket message // do other things}
CLI
default
$ pavane # or $ pv
server port
$ pavane -p 2000 # or $ pv -p 2222
custom path
# watch `src`, and set `dist` server path $ pavane -w src -s dist # or $ pv -w src -s dist
use config
setup pavane.config.js
const extname = moduleexports = watches: '*.js' '*.css' '*.html' '**/*.html' publics: __dirname port: 2222 // server port { // ... }
start width config
# start width config $ pavane -c # or $ pv -c
Use on other server
if your web application run on other server (python server, php server ...), add this script
in main template
<!-- if the server port is 2333 -->
Development
# server $ npm start # lint $ npm run test:lint # unit test $ npm run test:unit # coverage test $ npm run test:unit # cli # port $ cd test && node ../bin/index.js -p 2000 # config $ cd test && node ../bin/index.js -c
License
MIT