Asset packager for Rails 2

I’ve tried to fix asset_packager (http://synthesis.sbecker.net/pages/
asset_packager) for Rails 2, but while doing this, it seems like I’m
patching something that’s already built-in.

Is asset_packager actually built into Rails 2?

If so, how do I use it?

Thanks,
Helzer

It’s automagically used in production mode.

But, how do I use it?

Right now (Rails 1.2.6), I have the config/asset_packages.yml list of
packages and these two to instantiate the assets:
<%= stylesheet_link_merged :base %>
<%= javascript_include_merged :base %>

What do I need to do with the built in Rails 2 asset packager?

Doing the same, but just deleting the plugin/asset_packager didn’t
help.

Just specify:

<%= javascript_include_tag :defaults, 'reflection.js',

‘…’, :cache => true %>

<%= javascript_include_tag :defaults, 'reflection.js',

‘…’, :cache => true %>

  1. Using asset_packager, I had a rake task which created a single
    Javascript and single CSS file from the multiple JS, CSS files I use.
    It also compressed them. I ran this task when deploying.
    Do I need to do anything similar with the current scheme?

  2. I have another environment, which I called ‘sandbox’. This
    environment behaves exactly like the production environment (just with
    a different database). How should I tell Rails 2 to apply asset
    caching to this environment too?

Thanks,
Helzer

When :cache is true and ActionController::Base.perform_caching is
true, all the javascript files are combined into one all.js (same with
css files). However, the files are not compressed nor minified.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs