Skip to content

Instantly share code, notes, and snippets.

@stympy
Created December 12, 2011 21:27
Show Gist options
  • Save stympy/1469195 to your computer and use it in GitHub Desktop.
Save stympy/1469195 to your computer and use it in GitHub Desktop.
Skip asset pre-compilation when deploying if the assets didn't change
namespace :deploy do
namespace :assets do
task :precompile, :roles => :web, :except => { :no_release => true } do
from = source.next_revision(current_revision)
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
else
logger.info "Skipping asset pre-compilation because there were no asset changes"
end
end
end
end
@Martin91
Copy link

Hi all, is it essential to add lib/*/app/assets to my own list of locations to git log? Currently I have some gems downloaded, located under the /lib directory, and I sometimes need to edit their assets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment