Module: AssetsBooster::ViewHelper

Defined in:
lib/assets_booster/view_helper.rb

Instance Method Summary collapse

Instance Method Details

#assets_booster_tag(type, *names) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/assets_booster/view_helper.rb', line 19

def assets_booster_tag(type, *names)
  options = names.extract_options!
  packages = AssetsBooster::Railtie.packager.packages[type]
  html = names.map do |name|
    packages[name].view_helper(self, options)
  end*"\n"
  html.html_safe
end

#style_cdata_section(content) ⇒ Object



15
16
17
# File 'lib/assets_booster/view_helper.rb', line 15

def style_cdata_section(content)
  "\n/*#{cdata_section("*/\n#{content}\n/*")}*/\n".html_safe
end

#style_tag(content_or_options_with_block = nil, html_options = {}, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/assets_booster/view_helper.rb', line 3

def style_tag(content_or_options_with_block = nil, html_options = {}, &block)
  content =
    if block_given?
      html_options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)
      capture(&block)
    else
      content_or_options_with_block
    end

  (:style, style_cdata_section(content), html_options.merge(:type => Mime::CSS))
end