Code Monkey home page Code Monkey logo

opa's Introduction

OPA!

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!

options

-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...

/myApp
  /[public|static|www]
    /css/style.css
    index.html
  /lib
  entry.js|index.js

simply:

cd myApp/
opa

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.

Example

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

license

MIT

opa's People

Contributors

nhq avatar code-review-bot avatar

Watchers

James Cloos avatar Matthew Chase Whittemore avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.