Permalink
Browse files

Add build.js

  • Loading branch information...
1 parent 0e7023d commit 125801878b49f33a56ebd44d49ae86dc21d48b13 @mixu committed Jun 14, 2012
Showing with 24 additions and 2 deletions.
  1. +2 −0 .gitignore
  2. +1 −1 backends/browser_console.js
  3. +18 −0 build.js
  4. +2 −1 index.js
  5. +1 −0 minilog.js
View
@@ -1,2 +1,4 @@
test/temp.log
node_modules/
+test/example/hive
+dist/
@@ -6,7 +6,7 @@ module.exports = {
// and still useless for objects in IE9. But useful for non-IE browsers.
return console.log.apply(console, arguments);
}
- if(!JSON.stringify) return;
+ if(!JSON || !JSON.stringify) return;
// for IE8/9: make console.log at least a bit less awful
var args = Array.prototype.slice.call(arguments),
len = args.length;
View
@@ -0,0 +1,18 @@
+var fs = require('fs'),
+ path = require('path'),
+ Glue = require('gluejs');
+
+new Glue()
+ .basepath('./')
+ .include('./index.js')
+ .include('./minilog.js')
+ .include('./backends/browser_console.js')
+ .replace({ 'jquery': 'window.$' })
+ .export('Minilog')
+ .render(function (err, txt) {
+ if(err) throw err;
+ if(!path.existsSync('./dist')) {
+ fs.mkdirSync('./dist/');
+ }
+ fs.writeFileSync('./dist/minilog.js', txt);
+ });
View
@@ -3,5 +3,6 @@ exports = module.exports = require('./minilog.js');
exports.backends = {
// redis: require('./backends/redis.js'),
// nodeConsole: require('./backends/node_console.js'),
- jquery: require('./backends/jquery.js')
+// jquery: require('./backends/jquery.js')
+ browser: require('./backends/browser_console.js')
};
View
@@ -30,6 +30,7 @@ log.removeAllListeners = function(ev) {
function serialize(args) {
var items = Array.prototype.slice.call(args);
+ if(!JSON || !JSON.stringify) return items;
for(var i = 0; i < items.length; i++) {
if(typeof items[i] == 'object') { items[i] = JSON.stringify(items[i]); }
}

0 comments on commit 1258018

Please sign in to comment.