Permalink
Browse files

Merge pull request #1 from coryschires/master

premailer-rails3 support + docs
  • Loading branch information...
2 parents f4f6614 + 43d2e0f commit 7b19d432f0ad17c068779d9a513ec1f9ec3dedca @glebm committed Apr 30, 2012
Showing with 11 additions and 5 deletions.
  1. +10 −4 README.md
  2. +1 −1 app/views/rails_email_preview/emails/show.html.haml
View
14 README.md
@@ -73,17 +73,23 @@ To get the url of RailsEmailPreview in your main app you can call rails_email_pr
Premailer integration
---------------------
-[Premailer](https://github.com/alexdunae/premailer) (CSS inlining) integration can be done by using the <code>before_render</code> hook:
-
-For example, to process the previews with [ActionMailer Inline CSS](https://github.com/ndbroadbent/actionmailer_inline_css)
-can be done like so:
+[Premailer](https://github.com/alexdunae/premailer) automatically translates standard CSS rules into old-school inline styles. Integration can be done by using the <code>before_render</code> hook:
RailsEmailPreview.setup do |config|
config.before_render do |message|
ActionMailer::InlineCssHook.delivering_email(message)
end
end
+If you're your running Rails 3, you may consider using [premailer-rails3](https://github.com/fphilipe/premailer-rails3). It will inline CSS, automatically create plain text emails, and requires almost no configuration.
+
+ RailsEmailPreview.setup do |config|
+ config.before_render do |message|
+ PremailerRails::Hook.delivering_email(message)
+ end
+ end
+
+
Interface
---------
View
2 app/views/rails_email_preview/emails/show.html.haml
@@ -4,7 +4,7 @@
html_url = if @mail.multipart? || @mail.content_type =~ %r(text/html)
rails_email_preview.email_url(params.merge(:part_type => 'text/html'))
end
- plain_url = if @mail.multipart? || @mail.content_type =~ %r(text/plain)
+ plain_url = if @mail.multipart? || @mail.content_type =~ %r(text/plain) || Object.const_defined?('PremailerRails')
rails_email_preview.email_url(params.merge(:part_type => 'text/plain'))
end

0 comments on commit 7b19d43

Please sign in to comment.