summaryrefslogtreecommitdiffstats
path: root/lib/precompiler.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/precompiler.js')
-rw-r--r--lib/precompiler.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/precompiler.js b/lib/precompiler.js
index f673479..f0955e7 100644
--- a/lib/precompiler.js
+++ b/lib/precompiler.js
@@ -1,4 +1,4 @@
-
+/*eslint-disable no-console */
var fs = require('fs'),
Handlebars = require('./index'),
basename = require('path').basename,
@@ -70,10 +70,10 @@ module.exports.cli = function(opts) {
stat = fs.statSync(path);
if (stat.isDirectory()) {
fs.readdirSync(template).map(function(file) {
- var path = template + '/' + file;
+ var childPath = template + '/' + file;
- if (extension.test(path) || fs.statSync(path).isDirectory()) {
- processTemplate(path, root || template);
+ if (extension.test(childPath) || fs.statSync(childPath).isDirectory()) {
+ processTemplate(childPath, root || template);
}
});
} else {
@@ -99,7 +99,7 @@ module.exports.cli = function(opts) {
if (!root) {
template = basename(template);
} else if (template.indexOf(root) === 0) {
- template = template.substring(root.length+1);
+ template = template.substring(root.length + 1);
}
template = template.replace(extension, '');
@@ -114,12 +114,12 @@ module.exports.cli = function(opts) {
if (opts.simple) {
output.add([precompiled, '\n']);
} else if (opts.partial) {
- if(opts.amd && (opts.templates.length == 1 && !fs.statSync(opts.templates[0]).isDirectory())) {
+ if (opts.amd && (opts.templates.length == 1 && !fs.statSync(opts.templates[0]).isDirectory())) {
output.add('return ');
}
output.add(['Handlebars.partials[\'', template, '\'] = template(', precompiled, ');\n']);
} else {
- if(opts.amd && (opts.templates.length == 1 && !fs.statSync(opts.templates[0]).isDirectory())) {
+ if (opts.amd && (opts.templates.length == 1 && !fs.statSync(opts.templates[0]).isDirectory())) {
output.add('return ');
}
output.add(['templates[\'', template, '\'] = template(', precompiled, ');\n']);
@@ -134,8 +134,8 @@ module.exports.cli = function(opts) {
// Output the content
if (!opts.simple) {
if (opts.amd) {
- if(opts.templates.length > 1 || (opts.templates.length == 1 && fs.statSync(opts.templates[0]).isDirectory())) {
- if(opts.partial){
+ if (opts.templates.length > 1 || (opts.templates.length == 1 && fs.statSync(opts.templates[0]).isDirectory())) {
+ if (opts.partial) {
output.add('return Handlebars.partials;\n');
} else {
output.add('return templates;\n');