The project is in a healthy, maintained state
Capistrano plugin to precompile your Rails assets locally, remotely, or not at all provided with a very convenient default terminal prompt.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Capistrano Precompile Chooser

Gem Version RubyGems Downloads Buy Me a Coffee

Capistrano plugin to precompile your Rails assets locally, remotely, or not at all provided with a very convenient default terminal prompt.

By Default, on every deploy this plugin will prompt you on whether you want to precompile your assets locally, remotely, or not at all. Alternatively you can set some variable for fully automated deploys.

Works with both Sprockets and Propshaft.

$ cap production deploy

How do you want to compile assets? (local/remote/skip)
skip

Precompile Modes

  • local - Local Precompilation Mode (Improves Memory/Load Spikes on Server during Deploys)
  • remote - Remote Precompilation Mode (Rails Default)
  • skip - No Precompilation (Speeds up deployments with unchanged assets)

Installation

# Gemfile

group :development do
  gem "capistrano-precompile-chooser"
end
# Capfile

# require 'capistrano/rails' ### Comment Out or Remove this line
require 'capistrano/precompile_chooser'

If you want to be able to safely use the skip option you must add public/assets to your capistrano :shared_dirs variable

# config/deploy.rb

set :linked_dirs, %w{ <other-dirs> public/assets }

Usage

Now when running a deployment:

$ cap production deploy

How do you want to compile assets? (local/remote/skip)
skip

You can also use the $PRECOMPILE environment variable

$ PRECOMPILE_MODE="local" cap production deploy

Or for fully automated deploys

# Capfile

ENV['PRECOMPILE_MODE'] = 'local'
require 'capistrano/precompile_chooser'

Configuration Options,

### For Local Precompile Only
set :assets_dir,   "public/assets"
set :packs_dir,    "public/packs"
set :rsync_cmd,    "rsync -av --delete"
set :assets_role,  "web"

Credits

Created & Maintained by Weston Ganger - @westonganger