koa-watchify
Wraps a browserify or watchify instance into a koa middleware
Last updated 6 years ago by yoshuawuyts .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install koa-watchify 
SYNC missed versions from official npm registry.

koa-watchify

NPM version build status Test coverage Downloads

Wraps a browserify or watchify instance into a koa middleware.

Installation

$ npm install koa-watchify

Usage

const wreq     = require('koa-watchify')
const watchify = require('watchify')
const path     = require('path')
const koa      = require('koa')
const app      = koa()

var bundle = browserify({
  entries: [path.join(process.cwd(), 'index.js')],
  fullPaths: true,
  packageCache: {},
  cache: {}
})

if ('development' == process.env.NODE_ENV) bundle = watchify(bundle)

app.use(wreq(bundle))
app.listen(process.env.port || 1337)

Why?

Setting up boilerplate for browserify / watchify can be a bit annoying. This module provides a good entry point for both development and production servers running koa and browserify. No gulp, grunt or make needed.

Contributors

See Also

License

MIT

Current Tags

  • 1.1.1                                ...           latest (6 years ago)

7 Versions

  • 1.1.1                                ...           6 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.4                                ...           6 years ago
  • 1.0.3                                ...           6 years ago
  • 1.0.2                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (5)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |