Skip to content

Commit

Permalink
added command-line tool
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewschaaf committed Dec 21, 2010
1 parent 740ea0f commit 8e1f596
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/cli.js
@@ -0,0 +1,19 @@

var Haml = require('haml');

var readUntilEnd = function(stream, callback) {
var chunks = [];
stream.on('data', function(chunk) {
chunks.push(chunk.toString('utf-8'));
});
stream.on('end', function() {
callback(chunks.join(''));
});
}

readUntilEnd(process.openStdin(), function(template) {
process.stdout.write(
Haml.optimize(
Haml.compile(
template)));
});
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -3,6 +3,9 @@
"description": "Haml ported to server-side Javascript. This is a traditional server-side templating language.",
"keywords": ["haml", "template"],
"main" : "./lib/haml",
"bin": {
"haml-js": "./lib/cli.js"
},
"author": "Tim Caswell <tim@creationix.com>",
"version": "0.2.5"
}

0 comments on commit 8e1f596

Please sign in to comment.