From d60d1737cc017e7c4923b12cc550c380f694aff6 Mon Sep 17 00:00:00 2001 From: Drew LeSueur Date: Fri, 6 Feb 2015 07:16:01 -0700 Subject: [PATCH] fix bug with multiple rt files calling `rt *.rt` will cause the variable names of all the final template functions to be the same. This fixes that issue. --- src/api.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api.js b/src/api.js index 94d948b..5a8e05f 100644 --- a/src/api.js +++ b/src/api.js @@ -26,13 +26,17 @@ function convertFile(source, target, options, context) { } var html = fs.readFileSync(source).toString(); - if (options.modules === 'none' && !options.name) { + var shouldAddName = options.modules === 'none' && !options.name + if (shouldAddName) { options.name = reactTemplates.normalizeName(path.basename(source, path.extname(source))) + 'RT'; } var js = convertTemplateToReact(html, options); if (!options.dryRun) { fs.writeFileSync(target, js); } + if (shouldAddName) { + delete options.name + } } module.exports = {