Add sprockets md5s to asset tags

This commit is contained in:
Joshua Peek 2011-03-22 15:43:40 -05:00
parent 6aff1d0f6f
commit 628c31b353
2 changed files with 20 additions and 0 deletions

@ -173,6 +173,16 @@ def javascript_path(source)
#
# javascript_include_tag :all, :cache => true, :recursive => true
def javascript_include_tag(*sources)
if config.perform_caching
sources = sources.map do |source|
if source =~ /^\/assets\/(.+)/
"/assets/#{Rails.application.assets.url($1)}"
else
source
end
end
end
@javascript_include ||= JavascriptIncludeTag.new(config, asset_paths)
@javascript_include.include_tag(*sources)
end

@ -136,6 +136,16 @@ def stylesheet_path(source)
# stylesheet_link_tag :all, :concat => true
#
def stylesheet_link_tag(*sources)
if config.perform_caching
sources = sources.map do |source|
if source =~ /^\/assets\/(.+)/
"/assets/#{Rails.application.assets.url($1)}"
else
source
end
end
end
@stylesheet_include ||= StylesheetIncludeTag.new(config, asset_paths)
@stylesheet_include.include_tag(*sources)
end