Set assets specific folder

Hi,

Everytime i change my application to another server the assets folder id messes up, is there a way to set a specific folder to the assets?

Thanks

That won’t cause any problems unless you hardcode asset URLs in HTML, which should be avoided. Always use the return value of CAssetManager::publish() to determine the correct URL.

The problem is i changed some of the assets css.

You shouldn’t change anything directly in the assets folder, otherwise Yii will overwrite them again with the original file(s) an put them in a new asset folder.

When I want to change any CSS file, or JS, or image, I change them in the “source”: extension, widget… It works, although I am not sure it’s the best approach.

i ran into similar situation: when the host does not allow dynamic content (creating files). I did not dig deep enough to CAssetManager, however, you could mimic host environment in your local PC in term of path, then access all the pages possible which will generate all assets folders in your local PC, then upload all assets from your PC to your server.

if the new server allows dynamic content, then the best approach is to let Yii generate all the assets.

Zii widgets (at least ones that publish their own css file) have a property called "cssFile". You can set it to false, then copy the content of css file into main.css (or anywhere you want) and modify it as you need. Well written extensions should provide a similar mechanism to override css. There might be some not-so-well-written ones but you can always extend them.

Thanks phtamas for the good tip, I didn’t know that

Thanks, but the images inside the assets folder, what do i do?

The image files used by a css file should be normally placed in the relatively same directory from that css file.