Module: AssetLibrary::Helpers

Defined in:
lib/asset_library/helpers.rb

Defined Under Namespace

Classes: Priv

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
    AssetLibrary.cache_vars[:javascript_tags] ||= {}
    AssetLibrary.cache_vars[:javascript_tags][module_key] ||= asset_library_priv.script_tag(m.cache_asset)
  else
    m.assets(format).collect{|a| asset_library_priv.script_tag(a)}.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
    AssetLibrary.cache_vars[:stylesheet_tags] ||= {}
    AssetLibrary.cache_vars[:stylesheet_tags][[module_key, format]] ||= asset_library_priv.style_tag(m.cache_asset(format))
  else
    asset_library_priv.import_styles_tag(m.assets(format))
  end
end