Answer the question
In order to leave comments, you need to log in
Yii2, Assets: How to set it up correctly?
I want to take out, for example, the admin panel in a separate module. For the module, I assembled a separate layout and assets
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace app\modules\admin\assets;
use yii\web\AssetBundle;
/**
* author Qiang Xue <[email protected]>
* @since 2.0
*/
class AppAsset extends AssetBundle
{
public $sourcePath = '@app/modules/admin/assets/static';
public $css = [
'stylesheets/admin.css',
];
public $js = [
];
public $depends = [
'yii\web\YiiAsset',
];
}
use app\modules\admin\assets\AppAsset;
AppAsset::register($this);
Answer the question
In order to leave comments, you need to log in
public $publishOptions = [
'forceCopy' => true
];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question