mirror of
https://github.com/flarum/framework.git
synced 2025-01-20 22:40:45 +08:00
parent
c16ddf24f2
commit
5f83285442
|
@ -47,9 +47,18 @@ class ExtensionAssets implements AssetInterface
|
|||
{
|
||||
if ($this->js) {
|
||||
$sources->addString(function () {
|
||||
$name = $this->extension->getId();
|
||||
return 'var module={}';
|
||||
});
|
||||
|
||||
return 'var module={};'.$this->getContent($this->js).";flarum.extensions['$name']=module.exports";
|
||||
if (is_callable($this->js)) {
|
||||
$sources->addString($this->js);
|
||||
} else {
|
||||
$sources->addFile($this->js);
|
||||
}
|
||||
|
||||
$sources->addString(function () {
|
||||
$name = $this->extension->getId();
|
||||
return "flarum.extensions['$name']=module.exports";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -65,11 +74,6 @@ class ExtensionAssets implements AssetInterface
|
|||
}
|
||||
}
|
||||
|
||||
private function getContent($asset)
|
||||
{
|
||||
return is_callable($asset) ? $asset() : file_get_contents($asset);
|
||||
}
|
||||
|
||||
public function localeJs(SourceCollector $sources, string $locale)
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user