Update Russian translation of structure-assets.md (#18243)

This commit is contained in:
bscheshirwork
2020-08-19 13:38:33 +03:00
committed by GitHub
parent 705be8fb85
commit 6bfd21cead

View File

@ -118,6 +118,29 @@ namespace app\assets;
use yii\web\AssetBundle;
class FontAwesomeAsset extends AssetBundle
{
public $sourcePath = '@bower/font-awesome';
public $css = [
'css/font-awesome.min.css',
];
public $publishOptions = [
'only' => [
'fonts/*',
'css/*',
]
];
}
```
Более сложную логику можно реализовать с помощью переопределения `init()`. Ниже указан пример публикации поддиректорий этим способом:
```php
<?php
namespace app\assets;
use yii\web\AssetBundle;
class FontAwesomeAsset extends AssetBundle
{
public $sourcePath = '@bower/font-awesome';
@ -129,7 +152,10 @@ class FontAwesomeAsset extends AssetBundle
{
parent::init();
$this->publishOptions['beforeCopy'] = function ($from, $to) {
$dirname = basename(dirname($from));
if (basename(dirname($from)) !== 'font-awesome') {
return true;
}
$dirname = basename($from);
return $dirname === 'fonts' || $dirname === 'css';
};
}