6

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?

arogachev
  • 33,150
  • 7
  • 114
  • 117
Chinmay Waghmare
  • 5,368
  • 2
  • 43
  • 68

1 Answers1

8

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';
arogachev
  • 33,150
  • 7
  • 114
  • 117