diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Assets.php | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/Assets.php b/src/Assets.php index 78cbe59..a431ffb 100644 --- a/src/Assets.php +++ b/src/Assets.php @@ -4,19 +4,54 @@ namespace Lightscale\LaralightAssets; class Assets { - private string $manifestParser; + private string $defaultManifest; private array $manifests = []; private array $manifestsParsers = []; private array $files = []; private array $queuedHeadFiles = []; private array $queuedFooterFiles = []; + public function addManifest( + string $name, + Manifest $manifest, + bool $isDefault = false + ): void + { + $this->manifests[$name] = $manifest; + + if ($isDefault) { + $this->defaultManifest = $name; + } + } + public function registerManifest( string $name, string $path, string $baseUrl, + string $parserClass = JsonManifestParser::class, + bool $isDefault = false, ): void { + $this->addManifest( + $name, + new Manifest($path, $baseUrl, $parserClass), + $isDefault + ); + } + public function getManifests(): array + { + return $this->manifests; } + + public function getManifest(string $name): Manifest + { + return $this->getManifests()[$name]; + } + + public function getDefaultManifest(): Manifest + { + return $this->getManifest($this->defaultManifest); + } + } |