Skip to content

Instantly share code, notes, and snippets.

@deedubs
Created June 18, 2012 14:34
Show Gist options
  • Save deedubs/2948668 to your computer and use it in GitHub Desktop.
Save deedubs/2948668 to your computer and use it in GitHub Desktop.
var browserify = require('browserify')
, jade = require('jade')
, config = require('../config')
, bundle = browserify({
mount: '/app.js'
, require : { jquery: 'jquery-browserify', backbone: 'backbone-browserify' }
, watch: true
, debug: true
});
bundle.register('.jade', function (body) {
var options = {"client": true, "compileDebug": false};
body = "module.exports = " + jade.compile(body, options).toString() +";";
return body;
});
bundle.addEntry(config.root + '/app/js/index.js');
var jaderuntime = require('fs').readFileSync(config.root + "/node_modules/jade/runtime.js", 'utf8');
bundle.prepend(jaderuntime);
module.exports = function(app) {
app.use(bundle);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment