Module: ActiveMail::StylesHelper

Defined in:
app/helpers/activemail/styles_helper.rb

Overview

Embeds the compiled framework CSS as a <style> block so the Premailer adapter (string-only) inlines it — it can’t fetch the stylesheet_link_tag’s asset URL.

Constant Summary collapse

FRAMEWORK_STYLESHEET =
'activemail/activemail.css'

Instance Method Summary collapse

Instance Method Details

#activemail_inline_stylesObject

” (not raise) when the asset can’t be read — degrades to the link fallback, but warns, since the email then ships unstyled.



12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/activemail/styles_helper.rb', line 12

def activemail_inline_styles
  css = activemail_compiled_css
  if css.blank?
    ActiveMail.log_warning('[activemail] framework stylesheet could not be read from the asset pipeline; ' \
                           'email ships without inlined framework CSS')
    return ''.html_safe
  end

  (:style, css.html_safe, type: 'text/css')
end