Skip to content

Instantly share code, notes, and snippets.

@sylvinus
Created December 14, 2011 18:29
Show Gist options
  • Save sylvinus/1477837 to your computer and use it in GitHub Desktop.
Save sylvinus/1477837 to your computer and use it in GitHub Desktop.
exports.getCode = function(db,col,options,cb) {
mktemp("optimizedbuild",function(err,tmpfile) {
if (err) return cb(err);
var config = {
baseUrl: path.resolve(__dirname,'../../'),
name: "./databases/"+db+'/'+col,
out: tmpfile,
paths:{
"datajslib":path.resolve("./runtime/browser/datajslib"),
"runtime-browser":path.resolve("./runtime/browser/lib")
},
optimize:(options.minify?"uglify":"none")
};
require('requirejs').optimize(config, function (buildResponse) {
fs.readFile(tmpfile, 'utf8', cb);
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment