diff options
| author | Sam Light <sam@lightscale.co.uk> | 2025-03-31 00:50:18 +0100 | 
|---|---|---|
| committer | Sam Light <samlight1994@gmail.com> | 2025-03-31 00:50:18 +0100 | 
| commit | 3d91db66d05f2f226d3d64d1479fc6a5513a0793 (patch) | |
| tree | c8a2068840dc5a1be5af7c66cd0c095ed7e96de0 /src | |
| parent | a6fcc388252f661945039458e29d07c23ff32027 (diff) | |
Assets testing
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); +    } +  } | 
