Sha256: 161d2d9a30aef9db17cc9849d1981d6bc6d3ff348f1710e3f9abf533373312e9
Contents?: true
Size: 827 Bytes
Versions: 8
Compression:
Stored size: 827 Bytes
Contents
class Premailer module Rails class CustomizedPremailer < ::Premailer def initialize(html) # In order to pass the CSS as string to super it is necessary to access # the parsed HTML beforehand. To do so, the adapter needs to be # initialized. The ::Premailer::Adapter handles the discovery of # a suitable adapter. To make load_html work, an adapter needs to be # included and @options[:with_html_string] needs to be set. For further # information, refer to ::Premailer#initialize. @options = Rails.config.merge(with_html_string: true) Premailer.send(:include, Adapter.find(Adapter.use)) doc = load_html(html) options = @options.merge(css_string: CSSHelper.css_for_doc(doc)) super(doc.to_s, options) end end end end
Version data entries
8 entries across 8 versions & 2 rubygems