Browserify

From Code Self Study Wiki
Jump to: navigation, search

Use npm to install Browserify globally.

Get some npm modules:

npm --save-dev jquery

In your module:

var $ = require("jquery");
 
module.exports = function () {
    alert('something');
}

In your main.js file:

var myModule = require("./myModule");

Then concatenate the scripts:

browserify public/js/main.js -o public/js/bundle.js

See also Gulp.