Hello,
I’ve searched in the documentation as well as on Google, but was unable to find how to publish my widget’s asset bundle.
I’ve used Gii’s extension generator, and the current result is:
//Widget class:
class NestedSortable extends \yii\base\Widget
{
public function init()
{
$view = $this->getView();
NestedSortableAsset::register($view);
}
public function run()
{
return "Hello!";
}
}
// The bundle:
class NestedSortableAsset extends AssetBundle
{
public $basePath = '@vendor/ourcompany/yii2-nested-sortable/assets';
public $js = [
'nested-sortable.js'
];
public $depends = [
'frontend\assets\AppAsset',
];
}
The basepath is correct (the JS file is in projectroot/vendor/ourcompany/yii2-nested-sortable/assets/nested-sortable.js).
I can see
<script src="/nested-sortable.js"></script>
being generated and at the right position, but as you can see the path is not correct, probably because Yii2 didn’t published the asset bundle. I’ve searched all folders in public_html/assets/ but can’t find the js file anywhere.
Thank you!