nav_order |
---|
2 |
{: .no_toc }
{: .no_toc .text-delta }
- TOC {:toc}
Instead of creating instances by hand, it's sometimes easier to use configuration via array or file to manage your specific assets.
AssetFactory
is replaced step by step via Loaders. Methods are set to @deprecated
which have been moved to a Loader.
To create a single Asset from an array, you can do following:
<?php
use Inpsyde\Assets\AssetFactory;
use Inpsyde\Assets\Asset;
use Inpsyde\Assets\Style;
/** @var Style $asset */
$asset = AssetFactory::create(
[
'handle' => 'foo',
'url' => 'www.example.com/assets/style.css',
'location' => Asset::FRONTEND,
'type' => Style::class
],
);