| Path: | README |
| Last Update: | Wed Nov 12 17:29:43 -0500 2008 |
Asset Packager
Summary: Allow application to bundle up (and compress) asset files and include the compressed file in the view. This will make the application more efficient, because the browser won‘t need to make multiple request for each single asset files. The packaging/compression will only be performed in production mode, or when configatron.mack.asset_packager.disable_bundle_merge is not set.
Usage: First you will need to define asset group/bundle that you want to package up by doing the following:
assets_mgr.my_bundle_1 do |a|
a.add_js "foo.js"
a.add_js "jquery"
a.add_css "scaffold"
end
So the above code will create a new bundle called my_bundle_1, and in that group, you‘ll add 2 javascript files and 1 css file.
<%= stylesheet 'my_bundle_1 %> <%= javascript 'my_bundle_1 %>