Skip to content
Permalink
Browse files

Add css option for bin

  • Loading branch information...
wankdanker committed May 19, 2014
1 parent 960bc4f commit ce2d9e6dcdfac132e89270445fda2dd9cc9bcf88
Showing with 63 additions and 2 deletions.
  1. +11 −1 bin/tableify.js
  2. +4 −1 package.json
  3. +48 −0 style.css
@@ -1,14 +1,24 @@
#!/usr/bin/node

var tableify = require('../');
var argv = require('optimist').argv;
var fs = require('fs');

process.stdin.setEncoding('utf8');

var buf = '';

process.stdin.on('readable', function () {
buf += process.stdin.read();
buf += process.stdin.read() || "";
});

process.stdin.on('end', function () {
if (argv.style) {
var css = fs.readFileSync(__dirname + '/../style.css');
process.stdout.write('<style>' + css + '</style>');
}

process.stdout.write(tableify(JSON.parse(buf)));
});


@@ -10,5 +10,8 @@
"tableify": "./bin/tableify.js"
},
"author": "Dan VerWeire",
"license": "MIT"
"license": "MIT",
"dependencies": {
"optimist": "^0.6.1"
}
}
@@ -0,0 +1,48 @@
body {
font-family :arial;
padding : 0px;
margin : 0px;
}

table {
font-size: 8pt;
border-top : black 1px solid;
border-right : black 1px solid;
/* border-spacing : 10px */
border-collapse : collapse;
}

td, th {
text-align : left;
vertical-align : top;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
border-left : black 1px solid;
border-bottom: black 1px solid;
padding-left : 4px;
padding-right : 4px;
}

th {
background-color : #aaaaaa;
}

td.number {
color : blue
}

td.boolean {
color : green;
font-style : italic;
}

td.date {
color : purple;
}

td.null:after {
color : gray;
font-style : italic;
content : null;
}

0 comments on commit ce2d9e6

Please sign in to comment.
You can’t perform that action at this time.