Reputation: 7724
I have an asset's class AdminAssets
. In this class I have few js, css files for the admin pages. I want the assets mentioned in this class to be included in a view admin
(action: actionAdmin
), but I don't want any of the assets listed in AppAssets
to be included in this view. It's like detaching AppAssets
and attaching AdminAssets
only for one view. Is it possible?
Upvotes: 0
Views: 210
Reputation: 33548
To disable publishing AppAssets
for specific view, include this code before render:
use Yii;
...
// Replace 'app\assets\AppAssets' with the actual namespace of your AppAssets
Yii::$app->assetManager->bundles['app\assets\AppAssets'] = false;
Official docs:
Upvotes: 1