Repository is archived
No commit activity in last 3 years
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.
 Dependencies
 Project Readme

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

Install the plug-in from github:

script/plugin install git://github.com/yolk/rucksack.git

Create config/rucksack.yml:

rake rucksack:install

Config

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 %>

Deploy

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