0.1.0 • Published 9 years ago

connectifix v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 years ago

connectifix npm version

Starts a development preview web server for simple, static projects and opens them in the default browser. Includes directory indexes, compression, modrewrite and livereload. No HTTPS. Since this is an opiniated selection of middleware and configurations, look at the options section to determine if it's useful for you. If the outcome is positive, you are probably a front-end developer.

Installation

$ npm install connectifix

Command line usage

Package.json:

"config": {
  "connectifix": {
    "root": "path/to/document-root"
  }
},
"scripts": {
  "serve": "connectifix"
}

The config section is entirely optional. Cf. options. If you want to use it, you must run connectifix through a package script.

Terminal:

$ npm run serve

Programmatic usage

var connectifix = require('connectifix');
connectifix({/* cf. options */});

If no options are provided as an argument, connectifix looks for require('reverse-config').connectifix. Cf. Package.json under Command line usage. The resulting object (if any) is merged with the default options.

Options

All options are optional.

  • {Array} [files=["css", "html", "jpg", "png", "svg"]]
    • extensions of files under options.root that trigger live reload
  • {string} [host="localhost"]
    • web server hostname
  • {string} [index=""]
  • {number} [port=9000]
    • web server port; can't be lower than 1024
  • {boolean} [public=true]
    • true: connect listens to the host '0.0.0.0'
    • false: connect listens to the host options.host
  • {number} [reload=35729]
    • livereload server port
  • {Array} [rewrite=[]]
  • {string} [root="./public"]
    • path to the document root

License

MIT