Permalink
Browse files

added command-line tool

  • Loading branch information...
1 parent 740ea0f commit 8e1f5962a42902fecec256222886a5adb7430658 @andrewschaaf andrewschaaf committed Dec 21, 2010
Showing with 22 additions and 0 deletions.
  1. +19 −0 lib/cli.js
  2. +3 −0 package.json
View
@@ -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)));
+});
View
@@ -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.