Send to a Friend

AlexChoi's avatar

Stylesheet_link_tag, javascript_include_tag, caching problems?

Asked by AlexChoi (305points) June 2nd, 2008

So, the new caching for stylesheet_link_tag, javascript_include_tag
which rolls up the files into one all.js or all.css files is great…
however I’ve run into an issue:

If all.cs or all.js don’t exist, they get generated… great, I’ve
reduced the number of gets…

The problem is what occurs when the files already exist… even if
I’ve changed my list of js/css files to something completely
different, it won’t rewrite the file if it already exists…

Do we really need the unless in this block? (asset_tag_helper.rb)

def write_asset_file_contents(joined_asset_path, asset_paths)
  unless file_exist?(joined_asset_path)
    FileUtils.mkdir_p(File.dirname(joined_asset_path))
    File.open(joined_asset_path, “w+”) { |cache|
cache.write(join_asset_file_contents(asset_paths)) }
  end
end

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.