RecursiveAppAssetLocator
in package
implements
AppAssetsInterface
The recursive app asset locator does exactly this. It iterates over a folder that the application specified and list all the assets.
Please note that this does not assume that any of your files are not assets. Providing an asset directory to this locator will return a list of absolutely all the files in the directory and it's subdirectories.
Tags
Interfaces, Classes and Traits
- AppAssetsInterface
- The app assets interface enforces a pattern in which applications must be able to locate an asset for their operation, and they must be able to list all the assets they need to operate.
Table of Contents
- $basedir : mixed
- __construct() : mixed
- all() : Collection
- Returns the entire list of the assets needed for the application. Spitfire will then place these assets wherever they're needed.
- map() : string
- Returns the full path to the asset. Please note that there is a difference between the asset and the path it's at.
Properties
$basedir
private
mixed
$basedir
Methods
__construct()
public
__construct(mixed $basedir) : mixed
Parameters
- $basedir : mixed
Return values
mixed —all()
Returns the entire list of the assets needed for the application. Spitfire will then place these assets wherever they're needed.
public
all() : Collection
Return values
Collection —map()
Returns the full path to the asset. Please note that there is a difference between the asset and the path it's at.
public
map(string $asset) : string
While the concepts are similar, an asset is something relative to the asset directory of the application, something like 'my/script.js' which allows the developer of the application to reference it within his code with
asset($this->app, 'my/script.js'); //If the app is explicitly mentioned
The path is the location on disk it's located at, like /var/www/mydomain.com/public/bin/apps/myapp/assets/my/script.js
I don't think anyone would want to put this into their code-base more than once. Additionally, spitfire will move the file to /var/www/mydomain.com/public/assets/deploy/2020/04/21/myappsurl/my/script.js when building it, which is another, massive mouthful to write and manage.
Parameters
- $asset : string