capistrano / rails

Official Ruby on Rails specific tasks for Capistrano
http://www.capistranorb.com/
MIT License
871 stars 269 forks source link

Conditional preprocess assets? #236

Closed ChrisZou closed 4 years ago

ChrisZou commented 4 years ago

Hi, I found there is a conditionally_migrate option to let deployments migration database only if db/migration files changed. Do you consider adding a similar option for preprocessing assets, so that assets:preprocess task only runs if assets files changed?

mattbrictson commented 4 years ago

Currently I don't have plans to implement this. It is difficult to do, because there are a lot of factors that can affect how assets are compiled. For example, even if the asset files themselves haven't changed, upgrades to gems or changes to app configuration can affect the compilation step.

I assume that your goal is to speed up deployment times? In that case there are some things you can do to improve the speed of the rake assets:precompile task:

  1. Make sure these directories are in :linked_dirs: tmp/cache, public/assets.
  2. Install bootsnap to speed up Rails boot

In my case, for a medium-sized app, the rake assets:precompile task runs in 2-3 seconds if no assets have changed.

ChrisZou commented 4 years ago

I see. That was a fair point. Thank you for the explanation. @mattbrictson