optimal location for js files? (directory structure question)


After reading about the conventions, I am still wondering where the optimal location to put js files is.

Would this folder be assets?

thanks in advance,

  • thom

"assets" folder is used to keep asset files published by individual components.

If your js files are only used by your application (directly), you should not put them under "assets". Instead, put them under a Web-accessible directory like "js" should be sufficient.

A little bit of both really. I have a few modules for an oop framework I built that I'd like to convert for the Yii Framework.

Like OdinGallery, uses some mootools js files and css files. I'd like to keep them encapsulated. The module allows users to point at an xml file or a directory and turn it into a gallery by calling the gallery factory object.

  • thom

If you want to reuse your component (module), you may try to package the asset files (js, css, images, etc.) together with source code, and use asset publishing method to make them Web-accessible. The asset publishing method will copy the asset files to the "assets" folder. See CAssetManager about asset publishing. You should never manually copy anything to "assets" folder.

Thanks for your help  ;D

  • thom