Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

rucksack is a Rails plug-in to pack and compress CSS- and JavaScript-files with the YUI Compressor. It's easy extendable to use other compressors like Packer, JSMin and CSSTidy.

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 vendor
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.textile
Octocat-spinner-32 Rakefile
Octocat-spinner-32 init.rb

rucksack is a Rails plug-in to pack and compress CSS- and JavaScript-files with the YUI Compressor. It’s easy extendable to use other compressor-options like Packer, JSMin and CSSTidy.

Renaming for files managed by Git or SVN (as seen in earlier asset_package versions) are planned.

Inspired by asset_package and asset_compressor.


Install the plug-in from github:

script/plugin install git://

Create config/rucksack.yml:

rake rucksack:install


Please reorder and remove files in config/rucksack.yml so dependencies are loaded in correct order. In most cases you my want to structure your assets in different groups e.g. for different sections of your webapp or for different browsers/clients.

Change your javascript_include_tag and stylesheet_link_tag to javascript_include_packed and stylesheet_link_packed. For example:

<%= javascript_include_packed :base %>

<%= stylesheet_link_packed :base %>


On each deploy you have to run

rake rucksack:pack

before (!) restaring your applicationserver(s). Rucksack will silently fall back to your uncompressed assets when the files are missing.

If you use capistrano for deployment this is an easy one:

namespace :deploy do desc “Pack assets with rucksack” task :pack_assets, :roles => [:web,:app] do run “cd #{release_path} && rake RAILS_ENV=#{fetch(:rails_env, ‘production’)} rucksack:pack” end after “deploy:update_code”, “deploy:pack_assets” end

Please make sure you have java installed on your applicationserver(s), when using the YUICompressor.

rucksack was successful tested with Rails 2.2-2.3 and on Ruby 1.8.6 and 1.9.1

Something went wrong with that request. Please try again.