Module: RailsAppcache::ApplicationHelper

Included in:
ManifestsController
Defined in:
lib/rails_appcache/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#appcache_manifest_path(path) ⇒ Object



3
4
5
6
7
# File 'lib/rails_appcache/application_helper.rb', line 3

def appcache_manifest_path(path)
  return "" unless RailsAppcache.config.perform_caching?

  "/#{path}-#{appcache_version_string}.appcache"
end

#appcache_version_stringObject

In development, serve up a new manifest every time In production, serve the current Git revision



11
12
13
# File 'lib/rails_appcache/application_helper.rb', line 11

def appcache_version_string
  RailsAppcache.config.version
end

#asset_cache_path(path) ⇒ Object



29
30
31
# File 'lib/rails_appcache/application_helper.rb', line 29

def asset_cache_path(path)
  asset_path(path)
end

#javascript_cache_path(*paths) ⇒ Object



22
23
24
25
26
27
# File 'lib/rails_appcache/application_helper.rb', line 22

def javascript_cache_path(*paths)
  tags = javascript_include_tag(*paths)
  tags.scan(/src="(.*?)"/).map do |match|
    match[0].html_safe
  end.join("\n")
end

#stylesheet_cache_path(*paths) ⇒ Object



15
16
17
18
19
20
# File 'lib/rails_appcache/application_helper.rb', line 15

def stylesheet_cache_path(*paths)
  tags = stylesheet_link_tag(*paths)
  tags.scan(/href="(.*?)"/).map do |match|
    match[0].html_safe
  end.join("\n")
end