Skip to content
This repository
Browse code

added jade(1) --out support back

  • Loading branch information...
commit 7e5ee149292201d28c829cfa4e6b44df23de0a8c 1 parent 0db8f01
TJ Holowaychuk authored

Showing 1 changed file with 9 additions and 3 deletions. Show diff stats Hide diff stats

  1. +9 3 bin/jade
12 bin/jade
@@ -7,9 +7,10 @@
7 7 var fs = require('fs')
8 8 , program = require('commander')
9 9 , path = require('path')
10   - , resolve = path.resolve
11 10 , basename = path.basename
12 11 , dirname = path.dirname
  12 + , resolve = path.resolve
  13 + , join = path.join
13 14 , mkdirp = require('mkdirp')
14 15 , jade = require('../');
15 16
@@ -95,9 +96,14 @@ function renderFile(path) {
95 96 if (err) throw err;
96 97 var fn = jade.compile(str, options);
97 98 path = path.replace(re, '.html');
98   - fs.writeFile(path, fn(options), function(err){
  99 + if (program.out) path = join(program.out, basename(path));
  100 + var dir = resolve(dirname(path));
  101 + mkdirp(dir, 0755, function(err){
99 102 if (err) throw err;
100   - console.log(' \033[90mrendered \033[36m%s\033[0m', path);
  103 + fs.writeFile(path, fn(options), function(err){
  104 + if (err) throw err;
  105 + console.log(' \033[90mrendered \033[36m%s\033[0m', path);
  106 + });
101 107 });
102 108 });
103 109 // Found directory

0 comments on commit 7e5ee14

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