1
0
mirror of https://github.com/bobwen-dev/react-templates synced 2025-04-12 00:56:39 +02:00

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.
This commit is contained in:
Drew LeSueur 2015-02-06 07:16:01 -07:00
parent 5a43e9f28a
commit d60d1737cc

View File

@ -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 = {