简体   繁体   中英

How to precompile Ruby on Rails website into Production Mode?

I have locally made this website on my local Linux Debian 6 under path /HOME/ADMIN/WWW/WEBSTUDIO and I need it to be published on my virtual server.

Is "precompiling" the actual word? I know about the command 'rails server' but that is clearly not the same thing as it makes no alterations on the PUBLIC folder.

I guess I have to first transfer my directory structure to server (has Apache2 and ISPCONFIG3 already) and I have done everything so far as how it is described here , but it doesn't tell how to put and precompile your site into Prod Mode.

So what's the procedure? ONLY the basic steps.

在服务器终端上,从项目的根目录运行:

RAILS_ENV=production rake assets:precompile 

When you run rails server or rails s for short your start the rails server

The precompilation isn't for the code, it's for the assets (css,js,fonts, images, etc), rails compiles all css and js each to a single file to reduce the number of http requests needed to load the site.

Also if you are using scss , less or any of those files that need processing it would be done during the precompilation, and if any gems contain assets it would be copied to the public folder.

The precompilation command as mentioned in other answers/comments is

rake assets:precompile

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