Skip to content
Browse files

Added -o, --options STR to bin/jade

  • Loading branch information...
1 parent 9183e26 commit cd92acc25d6b06af20b5686d03d498d2270229dc @tj tj committed
Showing with 21 additions and 4 deletions.
  1. +21 −4 bin/jade
View
25 bin/jade
@@ -21,6 +21,12 @@ var args = process.argv.slice(2);
var pipe;
/**
+ * Options javascript.
+ */
+
+var options = {};
+
+/**
* Usage information.
*/
@@ -28,8 +34,9 @@ var usage = ''
+ '\x1b[1mUsage\x1b[0m: jade [options] <path ...>\n'
+ '\n'
+ '\x1b[1mOptions:\x1b[0m\n'
- + ' -p, --pipe Output to stdout instead of PATH.html\n';
- + ' -h, --help Output help information\n';
+ + ' -o, --options STR JavaScript options object passed\n'
+ + ' -p, --pipe Output to stdout instead of PATH.html\n'
+ + ' -h, --help Output help information\n';
// Parse arguments
@@ -45,7 +52,17 @@ while (args.length) {
break;
case '-p':
case '--pipe':
- pip = true;
+ pipe = true;
+ break;
+ case '-o':
+ case '--options':
+ var str = args.shift();
+ if (str) {
+ options = eval('(' + str + ')');
+ } else {
+ sys.error('-o, --options requires a string.');
+ process.exit(1);
+ }
break;
default:
files.push(arg);
@@ -56,7 +73,7 @@ while (args.length) {
if (files.length) {
files.forEach(function(file){
- jade.renderFile(file, function(err, html){
+ jade.renderFile(file, options, function(err, html){
if (err) throw err;
if (pipe) {
sys.puts(html);

0 comments on commit cd92acc

Please sign in to comment.
Something went wrong with that request. Please try again.