jquery and assets folder questions

ok heres my little confusion.

theres an assets folder that generates weird (i guess temp) names like "8f66af98" for jquery

now i noticed that i can disable this jquery auto loading functionality by doing this:








and simply include it in the main site layout page wherever i want.

but i suspect there might be some advantages to using the build in jquery system and by removing that ill be loosing the advantages.

but there are several things i want to change in the default behaviour of the jquery.

first i want the jquery to load at the bottom of the page, and any script to load below it

and second i want to use a custom loading technique to download the js files in parallel.

but are there any advantages to using the assets folder generated js files?

and what is the assets folder for anyway?

and how to customize it to meet my needs?

API for CAssetManager and CClientScript really cover everything.

i skimmed through the 2 guides (30mins)

and i still don’t see the point in them, ah well, ill just disable it then.

thanks for the links.


The asset system is necessary if you would like to:

  • dynamically publish your javascript and css files for each separate application component (e.g. menus, widgets, components, etc.)

  • only load the assets that you really need, minimizing the traffic between your webserver and end-user, speeding up page load

  • protect unused assets from direct access (since they stored under protected folder

  • separate the static content on another subdomain (http://assets.mysite.kz)

Weird folder-names, imho, are to avoid name duplication.

Each time you edit the original file, the asset manager checks for a new version of it and automacally copies new file to the appropriate asset folder.

thanks darmen, i see how those points are valid.

you are welcome :)


As there are ‘89d44c83’ folders inside assets. Can we manually keep the required css, javascript file by creating any folder_name inside the assets?

It’s better if you put your CSS and javascript files in another folder… so that the assets folder is just for Yii usage… this way when you upgrade Yii, for example, you can just empty the assets folder… if there would be some other scripts that your project needs… you would need to pay attention to not delete those scripts…

Thanks mdomba. And the next question: So during moving files in the live server, do we need to move these folders too or Yii will automatically does it?

You need to create the assets folder… and set its permission as writable by the web process… you don’t need to upload the content of this folder as Yii will populate it as needed…