Module: AssetLibrary::Helpers

Defined in:
lib/asset_library/helpers.rb

Instance Method Summary collapse

Instance Method Details

#asset_library_javascript_tags(module_key, format = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/asset_library/helpers.rb', line 3

def asset_library_javascript_tags(module_key, format = nil)
  m = AssetLibrary.asset_module(module_key)
  if AssetLibrary.cache
    @@asset_library_javascript_tags_cache ||= {}
    @@asset_library_javascript_tags_cache[module_key] ||= script_tag(m.cache_asset.relative_url)
  else
    m.assets(format).collect{|a| script_tag(a.relative_url)}.join("\n")
  end
end

#asset_library_stylesheet_tags(module_key, format = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/asset_library/helpers.rb', line 13

def asset_library_stylesheet_tags(module_key, format = nil)
  m = AssetLibrary.asset_module(module_key)
  if AssetLibrary.cache
    @@asset_library_stylesheet_tags_cache ||= {}
    @@asset_library_stylesheet_tags_cache[[module_key, format]] ||= style_tag(m.cache_asset(format).relative_url)
  else
    import_styles_tag(m.assets(format).collect{|a| a.relative_url})
  end
end