+ hmr assets from webpack encore dev-server supports

This commit is contained in:
2022-03-19 19:01:54 +03:00
parent 829231a79f
commit a35faa558c
4 changed files with 37 additions and 5 deletions

View File

@ -1,8 +1,11 @@
<?php namespace Wpstudio\AssetsManifest\Classes;
class ManifestReader
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Collection;
class ManifestReader implements Arrayable
{
private $manifest = null;
private Collection $manifest;
/**
* @param string $manifestPath
@ -18,11 +21,16 @@ class ManifestReader
throw new AssetsManifestException('Not readable: ' . $manifestPath);
}
$this->manifest = json_decode(file_get_contents($manifestPath));
$this->manifest = collect(json_decode(file_get_contents($manifestPath)));
}
public function get(string $assetName)
{
return $this->manifest->$assetName;
return $this->manifest->offsetGet($assetName);
}
public function toArray()
{
return $this->manifest;
}
}