1. Go to this page and download the library: Download blackcube/yii-assets library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
declare(strict_types=1);
use Blackcube\Assets\ManifestAssetLoader;
use Yiisoft\Aliases\Aliases;
use Yiisoft\Assets\AssetLoader;
use Yiisoft\Assets\AssetLoaderInterface;
use Yiisoft\Definitions\Reference;
return [
AssetLoaderInterface::class => [
'class' => ManifestAssetLoader::class,
'__construct()' => [
'innerLoader' => Reference::to(AssetLoader::class),
'aliases' => Reference::to(Aliases::class),
],
],
];
declare(strict_types=1);
namespace App\Asset;
use Blackcube\Assets\ViteAssetBundle;
final class AppAsset extends ViteAssetBundle
{
public ?string $basePath = '@assets';
public ?string $baseUrl = '@assetsUrl';
public ?string $sourcePath = '@assetsSource/dist-vite';
}
declare(strict_types=1);
namespace App\Asset;
use Blackcube\Assets\WebpackAssetBundle;
final class AppAsset extends WebpackAssetBundle
{
public ?string $basePath = '@assets';
public ?string $baseUrl = '@assetsUrl';
public ?string $sourcePath = '@assetsSource/dist-webpack';
}
$assetManager->register(AppAsset::class);
final class AppAsset extends WebpackAssetBundle
{
public ?string $basePath = '@assets';
public ?string $baseUrl = '@assetsUrl';
public ?string $sourcePath = '@assetsSource/dist-webpack';
// Explicit bundle order (default: auto-detect from catalog)
public array $bundles = ['manifest', 'vendors', 'app'];
// Load only CSS from these bundles (skip JS)
public array $cssOnly = [];
// Load only JS from these bundles (skip CSS)
public array $jsOnly = ['manifest'];
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.