mirror of
https://github.com/flarum/core.git
synced 2025-07-24 18:21:33 +02:00
@@ -47,9 +47,18 @@ class ExtensionAssets implements AssetInterface
|
|||||||
{
|
{
|
||||||
if ($this->js) {
|
if ($this->js) {
|
||||||
$sources->addString(function () {
|
$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)
|
public function localeJs(SourceCollector $sources, string $locale)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user