uify-server
browserify development and production server
Last updated 3 years ago by ahdinosaur .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install uify-server 
SYNC missed versions from official npm registry.

uify-server

browserify development and production server

npm install --save uify-server

part of uify@1

example

const { createServer } = require('http')
const Send = require('http-sender')()

const uifyServer = UifyServer({
  entry: join(__dirname, 'browser.js'),
  debug: process.env.NODE_ENV === 'development'
  optimize: process.env.NODE_ENV === 'production'
})

const server = createServer((req, res) => {
  uifyServer(req, res, {}, Send(req, res))
}).listen(8080)

see ./example for a complete example with pretty logs.

to run the example:

# in development (debug, watch, and live enabled)
NODE_ENV=development npm start

# in production (optimize and cache enabled)
NODE_ENV=production npm start

usage

UifyServer = require('uify-server')

uifyServer = UifyServer(options)

UifyServer receives an options object:

  • entry: path to the entry source file for browserify bundler (default: "./")

  • debug: enable source maps (default: true)

  • watch: enable bundle watcher (watchify) (default: true)

  • live: enable live reload for development (default: true)

  • livePort: a custom port to bind LiveReload server

  • optimize: optimize bundle for production (default: false)

  • cache: bundle once and cache for production (default: false)

  • pushState: support history.pushState by returning index.html on any requests that accept html (default: true)

  • bundler: a browserify-compatible bundler constructor (default: require('browserify'))

  • bundlerArgs: an object of arguments to pass to the bundler

  • script: the absolute path to serve the JavaScript bundle (default: "/bundle.js")

  • css: optional Cascading StyleSheet in default index.html

  • title: optional title for the default index.html

  • lang: optional language for the default index.html (default: "en")

  • head: optional string to insert into the default index.html between <head> and </head> (default: "<meta name="viewport" content="width=device-width, initial-scale=1">")

  • body: optional string to insert into the default index.html between <body> and </body>

  • favicon: optional favicon url for default index.html page

  • cwd: current working directory to base relative paths on

  • log: a pino-compatible logger instance

UifyServer returns a function of shape (req, res, context, next) => { next(err, value) }

uifyServer(req, res, context, next)

license

The Apache License

Copyright © 2017 Michael Williams

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Current Tags

  • 1.1.5                                ...           latest (3 years ago)

11 Versions

  • 1.1.5                                ...           3 years ago
  • 1.1.4                                ...           3 years ago
  • 1.1.3                                ...           4 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.4                                ...           4 years ago
  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (16)
Dev Dependencies (11)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |