README
Piping-browser
There are already wrappers such as brunch that offer to watch and rebuild all your client side files, and optionally launch a server for you. I wanted to launch my server and have it watch my client files and rebuild them (as well as itself, see piping)
Piping-browser uses browserify to package up your client side modules using commonjs. Browserify also gives us sourcemaps and support for node modules for free!
Installation
npm install piping-browser
Usage
Piping-browser is not a binary, so you can continue using your current workflow for running your application ("wooo!"). Basic usage is as follows:
require("piping-browser")({main:"./client/scripts/main.js",out:"./public/application.js"})
Options
- main (path): The path to the entry point of your application. this file is automatically executed on load. Relative to the file where piping-browser was required
- out (path): The path to where you want your bundled code to be written to. Relative to the file where piping-browser was required
- ignore (regex): Files/paths matching this regex will not be watched. Defaults to
/(\/\.|~$)/
- watch (boolean): Whether or not piping should rebuild on changes. Defaults to true, could be set to false for production
- debug (boolean): Whether browserify should run in debug mode or not. Debug mode turns on source maps. Defaults to true
- build (object): An object that maps file extensions, eg "coffee" to functions that take a filename and the files data and compiles it to javascript. By default can compile coffeescript files, with sourcemaps .
Piping-browser can also be used just by passing two strings. In this case, the strings are taken as the main and out options
require("piping-browser")("./client/scripts/main.js","./public/application.js")
piping-browser plays nice with piping. To use it, ensure piping-browser is required when piping returns false:
if(!require("piping")()){
require("piping-browser")("./client/scripts/main.js","./public/application.js")
return
}
// application logic here