summaryrefslogtreecommitdiffstats
path: root/lib/precompiler.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2015-04-16 15:42:46 -0500
committerkpdecker <kpdecker@gmail.com>2015-04-16 16:43:01 -0500
commite3d3eda2e1e03e997d417affc09974446b4ca701 (patch)
treea6513f267482b1693fd002c20488c6e92095ff2b /lib/precompiler.js
parent2a02261a5bc78f246c63dd8d467a12f2c1f63734 (diff)
downloadhandlebars.js-e3d3eda2e1e03e997d417affc09974446b4ca701.zip
handlebars.js-e3d3eda2e1e03e997d417affc09974446b4ca701.tar.gz
handlebars.js-e3d3eda2e1e03e997d417affc09974446b4ca701.tar.bz2
Add full support for es6
Converts the tool chain to use babel, eslint, and webpack vs. the previous proprietary solutions. Additionally begins enforcing additional linting concerns as well as updates the code to reflect these rules. Fixes #855 Fixes #993
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');