Skip to content

Instantly share code, notes, and snippets.

@kpumuk
Created November 18, 2009 10:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save kpumuk/237699 to your computer and use it in GitHub Desktop.
Save kpumuk/237699 to your computer and use it in GitHub Desktop.
Using bundled Jammit to precache assets in deploy.rb
namespace :deploy do
desc 'Bundle and minify the JS and CSS files'
task :precache_assets, :roles => :app do
root_path = File.expand_path(File.dirname(__FILE__) + '/..')
jammit_path = Dir["#{root_path}/vendor/gems/jammit-*/bin/jammit"].first
yui_lib_path = Dir["#{root_path}/vendor/gems/yui-compressor-*/lib"].first
assets_path = "#{root_path}/public/assets"
# Precaching assets
run_locally "ruby -I#{yui_lib_path} #{jammit_path}"
# Uploading prechached assets
top.upload assets_path, "#{current_release}/public", :via => :scp, :recursive => true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment