Sha256: 7b97987aa03e02780d9e2c3876e2159957ae79d504ff42655174840401189b52
Contents?: true
Size: 686 Bytes
Versions: 3
Compression:
Stored size: 686 Bytes
Contents
module ActionMailer module InlineCssHelper # Embed CSS loaded from a file in a 'style' tag. # CSS file can be given with or without .css extension, # and will be searched for in "#{Rails.root}/public/stylesheets/mailers" by default. def embedded_style_tag(file = mailer.mailer_name) ['.css', ''].each do |ext| [Rails.root.join("public", "stylesheets", "mailers"), Rails.root].each do |parent_path| guessed_path = parent_path.join(file+ext).to_s if File.exist?(guessed_path) return content_tag(:style, File.read(guessed_path), {:type => "text/css"}, false) end end end nil end end end
Version data entries
3 entries across 3 versions & 1 rubygems