Browserify Boilerplate Repository

Use this repository for when you want to start a new modular JavaScript application that gets compiled by Browserify. You start off with three JavaScript modules in the src/scripts directory.

  1. hello.js - Exports a simple function that says hello
  2. goodbye.js - Exports a simple function that says goodbye
  3. sandwichMaker.js - Exports an object with a single method named placeOrder()
  4. main.js - Contains the logic of your application. It imports the other three modules, and invokes all of the functions.

Setup

  1. Clone this repository.
  2. cd browserify-boilerplate/src/lib
  3. npm install
  4. npm start

The npm start command will run grunt for you.

The web server will be started, and the JavaScript code in the src/scripts directory will be compiled into public/bundle.js.

  1. Open Chome and make sure your developer tools are open.
  2. Open http://localhost:8080 in your browser.
  3. You should see the following output in the console.

sample boilerplate output