Adding just as another option
If I am not wrong you are using the widget I would extend the function run() which is registering the scripts and create my own asset class file with my custom css file loaded.
I assume that you are using the advance-app for Yii2, or adjust the namespace accordingly.
The AssetBundle class
<?php
namespace common\assets;
use yii\web\AssetBundle;
class CookieConsentAsset extends AssetBundle
{
public $sourcePath = __DIR__;
public $css = [
'path/to/custom.css',
];
public $depends = [
'dmstr\cookieconsent\assets\CookieConsentAsset'
];
}
and extend the widget class under common\components or common\widgets or whatever suits you
<?php
namespace common\components;
use dmstr\cookieconsent\widgets\CookieConsent as BaseCookieConsent;
use common\assets\CookieConsentAsset;
class CookieConsent extends BaseCookieConsent
{
public function run(){
CookieConsentAsset::register($this->view);
parent::run();
}
}
Now you can use your own widget by changing the namespace to
<?php
use common\components\CookieConsent;
echo CookieConsent::widget();