Capistrano::RailsPrecompileDeps

This gem provides a task for capistrano for precompiling Rails-based apps assets only when needed. The task identifies when to precompile by comparing the changes on the release against a list of folders to which the assets depend on.

Note: this task overrides the default deploy:assets:precompile.

Notes

If you use this integration with capistrano-rails, please ensure that you have capistrano-bundler >= 1.1.0.

Installation

Add this line to your application's Gemfile:

# Gemfile
gem 'capistrano', '~> 3.0'
gem 'capistrano-rails-precompile-deps', group: :development, require: false

And then execute:

$ bundle install

Usage

Require in Capfile to use the default task:

# Capfile
require 'capistrano/rails-precompile-deps'

On your deploy.rb set the dependencies:

set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb)

If a release contains any changes on the listed files and folders, your assets will get precompiled.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request