command line server + browserify

npm install opa
1 downloads in the last day
54 downloads in the last week
97 downloads in the last month


A quick command line bundler for prototyping front-end modules using browserify. As of the latest version of OPA, it uses browserify via watchify

npm install -g watchify opa

Just whip up a module and

opa -n -e *your-module.js*
// server running at http://localhost:11001

OPA will bundle your file, and serve an index.html. See public/index.html.
Your entry module will be watched for changes and browserified each update. If you have a static directory already, opa serves static files from that. OPA!


-c [dirName] creates a new directory with dirName, creates index.js, entry.js, and copies OPA's public/ dir to dirName.  Useful for creating new modules.
-e [path to entry.js] : declare your entry file, OPA looks for entry.js or index.js
-o [path to bundled file.js] : sets your bundle path, defaults to bundle.js
-s [static dir] : set your "public" directory if you have one. Opa will check for static/ www/ or public/, so if you have one of those, you can ignore this.
-n : tells OPA you don't have a static/public dir, so it uses its own to serve your bundle
-p [port number] : set port number, defaults to 11001
-d development - passes '-d' to browserify which makes testing easier

OPA uses the newest version of browserify, and also uses the brfs transform to turn fs.readFileSync() of any file (such as an html snippet) into strings you can use in your code.

If you have an app directory...



cd myApp/

opa will write your bundle to the directory, watch it for changes and serve it up. And it will serve you public dir using ecstatic.


opa defaults to the current directory, looks for entry.js or index.js, and bundles it for you. So you can simply

$ cd app/
$ opa
open http://localhost:11001

or use it on a single file and it will be served in an empty HTML file

/app$ cd ..
$ opa -e _somefile.js_ -n -p 3000
open http://localhost:3000



npm loves you