首页 > 解决方案 > Asset compilation takes too long in a rails production server. Is it possible to reduce by utilizing local?

问题描述

Currently we don't use Capistrano for some reason and here are the steps.

  1. SCSS files are edited in the local(my computer), and pushed to git.
  2. git pull at the production (aws)
  3. RAILS_ENV=production bundle exec rake assets:precompile
  4. Then passenger restart.

The problem we have here is that it takes (sometimes) a few minutes to create css and css.gz depending on how many scss files are modified.

Is it possible to compile all js, and scss at local(because it is ok to compile with a long period of time) and push files (css, css.gz, public/assets/.sprocket-manifest-xxx) to git?

标签: ruby-on-railsgit

解决方案


You could run RAILS_ENV=production bundle exec rake assets:precompile locally and then commit and push these files. Maybe look into deploying with rsync so you don't have to commit your compiled assets.

Also take a look at what the Rails Guide says about Local Precompilation.


推荐阅读