Template/Update (Part 47)
* split global.js into its components, so it can be reasonably processed by setup * make reputation requirements configurable * move Markup and Locale back into global.js (removed associated build scripts) * extend Icon to display iconId in lightbox popup
This commit is contained in:
parent
a48e94cd8b
commit
6557e70d5c
73 changed files with 26256 additions and 25699 deletions
|
|
@ -89,20 +89,36 @@ trait TrTemplateFile
|
|||
return;
|
||||
}
|
||||
|
||||
$content = file_get_contents($file);
|
||||
if (!$content)
|
||||
$result = '';
|
||||
|
||||
if (is_dir($file))
|
||||
{
|
||||
CLI::write('[build] template file is not readable - '.CLI::bold($file), CLI::LOG_ERROR);
|
||||
$this->success = false;
|
||||
return;
|
||||
$i = 0;
|
||||
foreach (glob($file.'/[A-Za-z0-9-_]*.*') as $f)
|
||||
{
|
||||
$i++;
|
||||
if (($content = $this->applyCfg($f)) === null)
|
||||
return;
|
||||
|
||||
yield $content;
|
||||
|
||||
$result .= $content . "\n";
|
||||
}
|
||||
|
||||
if (!$i)
|
||||
CLI::write('[build] template dir is empty - '.CLI::bold($file), CLI::LOG_WARN);
|
||||
}
|
||||
else /* if (is_file($file)) */
|
||||
{
|
||||
if (($content = $this->applyCfg($file)) === null)
|
||||
return;
|
||||
|
||||
yield $content;
|
||||
|
||||
$result .= $content . "\n";
|
||||
}
|
||||
|
||||
// replace constants
|
||||
$content = Cfg::applyToString($content);
|
||||
|
||||
yield $content;
|
||||
|
||||
if (CLISetup::writeFile($this->fileTemplateDest[$idx], $content))
|
||||
if (CLISetup::writeFile($this->fileTemplateDest[$idx], $result))
|
||||
continue;
|
||||
|
||||
$this->success = false;
|
||||
|
|
@ -134,6 +150,17 @@ trait TrTemplateFile
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function applyCfg($file) : ?string
|
||||
{
|
||||
// replace constants
|
||||
if ($content = file_get_contents($file))
|
||||
return Cfg::applyToString($content, $this->numFmt ?? true);
|
||||
|
||||
CLI::write('[build] template file is not readable - '.CLI::bold($file), CLI::LOG_ERROR);
|
||||
$this->success = false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
trait TrImageProcessor
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue