public
Description: Rake tasks for merge and compress your stylesheets and javascripts
Homepage: http://lucaguidi.com/pages/assets_packager
Clone URL: git://github.com/jodosha/assets_packager.git
name age message
file MIT-LICENSE Mon Feb 23 03:14:10 -0800 2009 Added sprocketized version of rake tasks [Luca Guidi]
file README Mon Feb 23 03:14:10 -0800 2009 Added sprocketized version of rake tasks [Luca Guidi]
file assets_packager_sprockets_tasks.rake Mon Feb 23 06:26:48 -0800 2009 Fixed Sprockets path [Luca Guidi]
file assets_packager_tasks.rake Wed Oct 15 06:51:39 -0700 2008 First version [Luca Guidi]
file jsmin Wed Oct 15 06:51:39 -0700 2008 First version [Luca Guidi]
README
AssetsPackager
==============

When you deploy your application it could be convenient to package all your
stylesheets and javascripts in a single file, let say all.css and all.js, in
order to decrease the HTTP requests against your server.

You may also find useful to reduce the size of those files, through a process
which eliminates all unneeded white spaces and comments.

AssetsPackager Rake tasks will help you in solving those problems.



= Installation
Copy assets_packager_tasks.rake under lib/tasks and jsmin under script/.
If you use Sprockets (http://getsprockets.org) copy assets_packager_sprockets_tasks.rake instead.



= How It works?
First of all, we need to generate a configuration file:

$ rake assets:config

Look for a file called assets.yml in your config directory and make sure the
order of listed files is the same you wish to have in your application
(i.e. prototype.js before of effects.js, or lowpro.js before of my_behavior.js).
Feel free of edit it.

We are now ready for merge and compress our files:

$ rake assets:package



Now, in your application make sure of use #javascript_include_tag and
#stylesheet_link_tag with the :cache => true option.



= Credits
AssetsPackager was strongly inspired by the homonym plugin written by
Scott Becker (http://synthesis.sbecker.net/), but I don't like the
approach used by him.

I don't like the idea of load a plugin for something I don't need in production
mode. In fact you should execute those tasks before your app will be started
(i.e. Capistrano post deploy task).

It also introduces new helpers (#javascript_include_merged) which substantially,
reproduce the same behavior of the :cache => true option.

Last, but not least, I don't like the naming system: base_1150571523.js
If you use Mongrel this means to have something like this:

<script type="text/javascript" src="/javascripts/base_1150571523.js?1150571523"></script>

Which sounds a bit redundant, if compared with all.js?1150571523



Uladzislau Latynski for his jsmin.rb Ruby porting.



Thanks to Steve Souder (http://stevesouders.com/) for his High Performance
Web Sites book.


Copyright 2008 - 2009 Luca Guidi - www.lucaguidi.com - Released under MIT License