ruby-on-rails - 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.
- SCSS files are edited in the local(my computer), and pushed to git.
- git pull at the production (aws)
- RAILS_ENV=production bundle exec rake assets:precompile
- 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?
解决方案
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.
推荐阅读
- c# - OnGround Raycast 在缩放 fps 字符后不起作用
- javascript - 为什么这不会在第二次单击按钮时将 el 更改为 msgTwo?
- angular - 以角度显示表单字段错误的灵活方法是什么
- mobx - Mobx 反应不跟踪从构造函数参数传递的可观察值
- html - 你如何制作一个覆盖整个顶部屏幕的导航栏?
- java - 无法使用 java 套接字将图像从 android studio 发送到 pc,filePath 返回 null
- reactjs - 做什么{" "} 在 react.js 中是什么意思?
- swift - 从 AppDelegate 推送 SwifuUIscreen
- python - 在 Python 中限制线性回归的 x 值范围
- android - 当我打开某个屏幕时,为什么我的 react-native 应用程序会崩溃?