Skip to content

Commit

Permalink
Revert "Set the mtime of pre-cached assets to the newest mtime of the…
Browse files Browse the repository at this point in the history
… files being packaged."

This reverts commit ef54119.
  • Loading branch information
jashkenas committed May 24, 2011
1 parent 7c02fc1 commit 3fb2bfc
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/jammit/packager.rb
Expand Up @@ -38,13 +38,13 @@ def initialize
# changed since their last package build.
def precache_all(output_dir=nil, base_url=nil)
output_dir ||= File.join(PUBLIC_ROOT, Jammit.package_path)
cacheable(:js, output_dir).each {|p| cache(p, 'js', pack_javascripts(p), output_dir, nil, newest_mtime(p, :js)) }
cacheable(:js, output_dir).each {|p| cache(p, 'js', pack_javascripts(p), output_dir) }
cacheable(:css, output_dir).each do |p|
mtime = newest_mtime(p, :css)
cache(p, 'css', pack_stylesheets(p), output_dir, nil, mtime)
cache(p, 'css', pack_stylesheets(p), output_dir)
if Jammit.embed_assets
cache(p, 'css', pack_stylesheets(p, :datauri), output_dir, :datauri, mtime)
cache(p, 'css', pack_stylesheets(p, :datauri), output_dir, :datauri)
if Jammit.mhtml_enabled && base_url
mtime = Time.now
asset_url = "#{base_url}#{Jammit.asset_url(p, :css, :mhtml, mtime)}"
cache(p, 'css', pack_stylesheets(p, :mhtml, asset_url), output_dir, :mhtml, mtime)
end
Expand Down Expand Up @@ -73,11 +73,6 @@ def individual_urls(package, extension)
package_for(package, extension)[:urls]
end

# Return the modification time of the newest file in the package
def newest_mtime(package, extension)
package_for(package, extension)[:paths].map { |path| File.mtime(path) }.max
end

# Return the compressed contents of a stylesheet package.
def pack_stylesheets(package, variant=nil, asset_url=nil)
@compressor.compress_css(package_for(package, :css)[:paths], variant, asset_url)
Expand Down

0 comments on commit 3fb2bfc

Please sign in to comment.