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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -