Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii2 Can we change the assets directory location?

Yii2 automatically generates the assets in web folder. How can we change it to any other folder?

For example. If I create a folder named myassets in web folder. It is possible to store all the assets in this folder?

like image 841
Chinmay Waghmare Avatar asked Mar 31 '15 11:03

Chinmay Waghmare


1 Answers

You can change it by editing $basePath of AssetManager.

Through application config:

'assetManager' => [
    'basePath' => '@webroot/my-assets',
],

Through application component:

\Yii:$app->assetManager->basePath = '@webroot/my-assets';
like image 53
arogachev Avatar answered Sep 30 '22 20:09

arogachev