Permalink
Browse files

Merge pull request #6 from nchen-sfly/pull-request

- Update cachePartials() to skip over non-files.
  • Loading branch information...
2 parents 5e4fd2d + e2b3462 commit 5d7b802204cbeb2b7f50d3dcc0136a9100a6eaa3 @mgutz mgutz committed Dec 14, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/hbs.js
View
@@ -110,7 +110,11 @@ function cachePartials() {
var files = fs.readdirSync(partialsDir);
files.forEach(function(file) {
- var source = fs.readFileSync(path.join(partialsDir, file), 'utf8');
+ var filePath = path.join(partialsDir, file);
+ var stats = fs.statSync(filePath);
+ if (!stats.isFile()) return;
+
+ var source = fs.readFileSync(filePath, 'utf8');
var name = path.basename(file, path.extname(file));
exports.handlebars.registerPartial(name, source);
});

0 comments on commit 5d7b802

Please sign in to comment.