Created
June 25, 2014 04:25
-
-
Save Raynos/58eb74dbf8a88635b721 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bundle = require('./bundle.js') | |
bundle('whatever/code/you/want.js', function (err, module) { | |
/* do shit, hooray */ | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path') | |
module.exports = bundle; | |
function bundle(script, opts, cb) { | |
if (typeof opts === 'function') { | |
cb = opts; | |
opts = {}; | |
} | |
var mount = opts.mount || '/browser'; | |
loadScript(mount + '/' + script, function (err) { | |
if (err) { | |
return cb(err); | |
} | |
cb(null, window[script]) | |
}) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Router = require('routes-router') | |
var http = require('http') | |
var ServeBrowserify = require('serve-browserify') | |
var router = Router(); | |
router.addRoute('/browser/*', ServeBrowserify({ | |
root: path.join(__dirname, 'browser'), | |
base: '/browser', | |
standalone: true | |
})) | |
http.createServer(router).listen(3000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment