Yii Framework Forum: Change assets write directory on yii2 basic application template - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Change assets write directory on yii2 basic application template Rate Topic: -----

#1 User is offline   mostofa62 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 11-April 13
  • Location:Chittagong, Bangladesh

Posted 21 November 2016 - 01:58 AM

Yii2 default write applications compile asset cache on /assets directory.

Where also default AppAsset class [AppAsset.php] or any other asset class files are located.

To separate our assets cache we can change assets cache write directory by override assetManager component in web.php on /config.

1. Create a directory at webroot or application root [ Example : /assets-cached ]
2. Be sure it’s writeable.
3. Open /config/web.php under component add following:




'assetManager' => [

                        'basePath'=>'@webroot/assets-cached',

                        'baseUrl'=>'@web/assets-cached'

],



Now we can clean your /assets-cached directory when required.
most of time for clean CSS or JavaScript cache.
1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users