I'm not use AppAsset for javascipr library, but how to call js file from bower
I write :
$this->registerJsFile('/bower/flot/jquery.flot.js', [
'baseUrl' => '@vendor',
'depends' => 'yii\jui\JuiAsset',
]);
//or
$this->registerJsFile(Yii::$app->request->baseUrl .'/vendor/bower/flot/jquery.flot.pie.js', [
'depends' => 'yii\jui\JuiAsset',
]);
Not working
list(,$url)=Yii::$app->assetManager->publish('@bower/flot/jquery.flot.js');
$this->registerJsFile($url, ['depends' => 'yii\jui\JuiAsset']);
Thanks for your suggest
But is there a simple way ?
What if many library to register ?
you can publish full dirictory.
list(,$url)=Yii::$app->assetManager->publish('@bower/flot');
$this->registerJsFile($url.'/jquery.flot.js', ['depends' => 'yii\jui\JuiAsset']);
$this->registerJsFile($url.'/another.js', ['depends' => 'yii\jui\JuiAsset']);
$this->registerJsFile($url.'/jquery.etc.js', ['depends' => 'yii\jui\JuiAsset']);
for more simple register. create AssetBundle for your js (and css).
Thanks :+1:
Most helpful comment
you can publish full dirictory.
for more simple register. create
AssetBundlefor your js (and css).