Permalink
Browse files

added directory support

  • Loading branch information...
1 parent 51c6de0 commit fe5c4d600a3a1b0d991d0ec2ad24e45ed981ff22 @jgallen23 committed Mar 11, 2012
Showing with 20 additions and 9 deletions.
  1. +3 −3 bin/clientjade
  2. +4 −1 docs/index.md
  3. +12 −4 lib/compile.js
  4. +1 −1 site
View
@@ -6,15 +6,15 @@ var compile = require('../lib/compile');
program
- .version('0.0.3')
+ .version('0.0.4')
.option('-c, --compress', 'Compress output')
- .usage('<options> <jade files>');
+ .usage('<options> <jade files/folder>');
program.on('--help', function() {
console.log(' Examples:');
console.log('');
console.log(' # compile jade files into js');
- console.log(' $ clientjade test1.jade test2.jade > jade.js');
+ console.log(' $ clientjade test1.jade test2.jade templates/ > jade.js');
});
program.parse(process.argv);
View
@@ -9,7 +9,7 @@ clientjade is a command line tool to compile your jade templates into client sid
##Usage
`bash
- Usage: clientjade <options> <jade files>
+ Usage: clientjade <options> <jade files/dir>
Options:
@@ -56,6 +56,9 @@ You can check out a live example [here](example/)
##History
+###0.0.4
+- added support for passing in folder
+
###0.0.3
- passed in filename so jade includes will work
View
@@ -29,10 +29,18 @@ var compile = function(options, callback) {
queue.push(runtime);
queue.push(render);
- for (var i = 0, c = options.files.length; i < c; i++) {
- var file = options.files[i];
- queue.push(file);
- }
+ options.files.forEach(function(file, i) {
+ var stats = fs.statSync(file);
+ if (!stats.isFile()) { //directory
+ var files = fs.readdirSync(file);
+ files.forEach(function(file, i) {
+ if (file.match(/\.jade$/))
+ queue.push(file);
+ });
+ } else {
+ queue.push(file);
+ }
+ });
queue.run(function(results) {
var concat = [];
2 site
Submodule site updated 1 files
+5 −1 index.html

0 comments on commit fe5c4d6

Please sign in to comment.