v0.1.10
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user