简体   繁体   中英

Yii Can't create javascript files in assets folder

If i create a new yii project, everything is ok. But if copy this project to other folder or upload the server, yii can't create javascript files in assets folder automatically. No problem at the necessary folder permissions. Css files are generating. Problem is js files.

If I copy js files manually, working properly. But some of the projects may be needed to replicate a lot of. So it is a very difficult process.

How can I solve this problem ?

You need to remove all of old sub folders in assets directory of your site(on your server), run site again to check the new generated folders, are they created? or just CSS file only again?

Understanding "Assets"

Maintenance of the assets folder Many newcomers ask: "What do we do with the assets folder?", and the answer is "Mostly nothing".

It's important that the directory be writable by the webserver user so that Yii can publish the resources there when needed. When a project has multiple versions (production, testing, development, etc.) do not copy the assets/ folders from one area to another; allow Yii to deploy them automatically in each area. Do not manually edit any file under assets/ - if you have a real need to make a change, find the publishing module, edit the source, delete the subfolder under assets/, and let Yii re-publish the updated files. Do not reference names under the assets/ folder directly (say, to get at some other module's assets). If you need to use that Do not add the contents of the assets/ folder to any source-code control system; these files have master source in other places. It is safe to delete everything under assets/. Yii will re-publish the assets if they are not found under assets/.

There was too little information for me to look at to diagnose where you got mistake. I don't consider this is an answer but there are so many things to put them all in comment. If it doesn't help, you should post more information in detail:

  • (1) Your code worked on local and it did not do after you uploaded them to server?
  • (2) skip this if (1) is correct, otherwise, I would like to see what you do with the code of publishing your site's asset (css, js) (just put them all in your question), don't forget to check whether the js file path exist or not

I had some problems with the naming of files, due to developing on windows and when I wanted to move the app to a linux host, It couldn't find some files, because of case sensativity of linux file system.

you might need to check your file names.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM