This commit is contained in:
2025-08-01 14:29:50 +03:00
parent 2ab819ff30
commit b86b8ff923
54 changed files with 1512 additions and 672 deletions

View File

@@ -7,8 +7,12 @@ class Assets
protected array $jsHeader = [];
protected array $jsBody = [];
protected array $collectorJs = [];
protected array $css = [];
protected array $collectorCss = [];
protected string $resourceURI = "/resource";
public function __construct(string $resourceURI)
@@ -26,7 +30,7 @@ class Assets
$this->resourceURI = $resourceURI;
}
public function registerJS(string $slug, string $resource, bool $body = true, bool $addResourceURI = true): void
public function registerJS(string $slug, string $resource, bool $body = true, bool $addResourceURI = true, string $after = null): void
{
$resource = $addResourceURI ? $this->resourceURI . $resource : $resource;
if ($body) {
@@ -34,12 +38,14 @@ class Assets
} else {
$this->jsHeader[$slug] = $resource;
}
$this->collectorJs[$slug] = ['resource' => $resource, 'after' => $after, 'body' => $body];
}
public function registerCSS(string $slug, string $resource, bool $addResourceURI = true): void
public function registerCSS(string $slug, string $resource, bool $addResourceURI = true, string $after = null): void
{
$resource = $addResourceURI ? $this->resourceURI . $resource : $resource;
$this->css[$slug] = $resource;
$this->collectorCss[$slug] = ['resource' => $resource, 'after' => $after];
}
public function getJSAsStr(bool $body = true): void
@@ -63,4 +69,14 @@ class Assets
}
}
public function getCollectorCss(): array
{
return $this->collectorCss;
}
public function getCollectorJs(): array
{
return $this->collectorJs;
}
}