Module: Packrat::ViewHelpers

Defined in:
lib/packrat/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#packrat_css(&block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/packrat/view_helpers.rb', line 4

def packrat_css(&block)
  c = capture(&block)
  premailer = Premailer.new(StringIO.new(c), :local_file => false)
  inlined = premailer.to_inline_css

  if Rails::VERSION::MAJOR == 2
    concat(inlined)
  elsif Rails::VERSION::MAJOR == 3
    inlined.html_safe
  else
    puts "Sorry, Packrat only works with Rails 2.x and Rails 3.x"
  end

end