Tuesday, May 19, 2015

Browserify

Browserify is a JavaScript utility for running CommonJS modules in the browser.
After installing nodeJS, you install browserify by using the following command
npm install –g Browserify (-g to install globally and run browserify from the command line)

Suggest that you want app.js file to be used in the browser
Windows: browserify –r ./app/main.js:app > static bundled.js
Linux: nodejs /usr/local/bin/browserify –r ./app/main.js:app > static bundled.js

Browserify will resolve all the dependencies of main.js file and bundle them in bundled.js

No comments: