mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Even less redundant
This commit is contained in:
parent
9d6a444fc6
commit
6136838d17
@ -306,20 +306,22 @@ function scanTagsDir(tagsConfigPath, tagsConfigDirname, dir, taglib) {
|
|||||||
tag.name = childFilename;
|
tag.name = childFilename;
|
||||||
taglib.addTag(tag);
|
taglib.addTag(tag);
|
||||||
} else {
|
} else {
|
||||||
var templateCode;
|
var exTemplateFile;
|
||||||
if (fs.existsSync(templateFile)) {
|
if (fs.existsSync(templateFile)) {
|
||||||
templateCode = fs.readFileSync(templateFile, {encoding: 'utf8'});
|
exTemplateFile = templateFile;
|
||||||
}
|
}
|
||||||
else if (fs.existsSync(templateFile + ".html")){
|
else if (fs.existsSync(templateFile + ".html")){
|
||||||
templateFile = templateFile + ".html";
|
exTemplateFile = templateFile + ".html";
|
||||||
templateCode = fs.readFileSync(templateFile, {encoding: 'utf8'});
|
|
||||||
}
|
|
||||||
tagDef = tagDefFromCode.extractTagDef(templateCode);
|
|
||||||
if (!tagDef) {
|
|
||||||
tagDef = createDefaultTagDef();
|
|
||||||
}
|
}
|
||||||
|
if(exTemplateFile){
|
||||||
|
var templateCode = fs.readFileSync(exTemplateFile, {encoding: 'utf8'});
|
||||||
|
tagDef = tagDefFromCode.extractTagDef(templateCode);
|
||||||
|
if (!tagDef) {
|
||||||
|
tagDef = createDefaultTagDef();
|
||||||
|
}
|
||||||
|
|
||||||
tagDef.template = templateFile;
|
tagDef.template = exTemplateFile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tagDef) {
|
if (tagDef) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user