Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chemzqm/koa-liveload
liveload middleware for koa
https://github.com/chemzqm/koa-liveload
Last synced: 3 months ago
JSON representation
liveload middleware for koa
- Host: GitHub
- URL: https://github.com/chemzqm/koa-liveload
- Owner: chemzqm
- Created: 2014-02-11T09:00:43.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2017-12-13T22:06:18.000Z (about 7 years ago)
- Last Synced: 2024-05-27T12:40:01.587Z (7 months ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 12
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# koa-liveload
A liveload middleware for [koa](https://github.com/koajs/koa).
This middleware will inject a script tag for [tiny-lr]() communication into html response, and watch the resource files,
when any resource file get changed the browser will be notified to reload, css file changes would not cause a page refresh.**note**, this middleware is disabled on `test` nad `production` environment.
Added folder and file will be watched for changes automatically.
## Install
$ npm install koa-liveload
## Example
``` js
var koa = require('koa');
var liveload = require('koa-liveload');
var koa_static = require('koa-static');var app = koa();
app.use(liveload(__dirname, {
includes: ['jade'],
excludes: ['components']
}))
app.use(koa_static(__driname));app.listen(3000);
```## API
``` js
function liveload(directory, [options]);
```### Options
* `port` port for tiny-lr server [35927]
* `ignoreHidden` ignore dot files [true]
* `includes` include file extensions other than js, css, html
* `excludes` exclude folder names other than node_modules## License
MIT