php - how and where to include js and css for modules? -
i have modules category:
+modules/ +category/ +assets/ +css/ +js/ +images/ +components/ +controllers/ +models/ +views/ -categorymodule.php
what best way includes css , jss views?
publish , register in categorymodule
init
method - make available css , js in category module.
this:
public function init() { $path = $this->assetmanager->publish(yii::getpathofalias('application.modules.category.assets')); $this->clientscript->registercssfile($path . '/css/some-css.css', 'screen, projection'); $this->clientscript->registerscriptfile($path . '/js/some-js.js'); }
Comments
Post a Comment