All Projects → premailer → Actionmailer_inline_css

premailer / Actionmailer_inline_css

Licence: mit
Seamlessly integrate Alex Dunae's premailer with ActionMailer.

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to Actionmailer inline css

asm-inline
Inline raw ASM instructions in Java
Stars: ✭ 23 (-67.61%)
Mutual labels:  inline
phplatex
Inline TeX in PHP pages
Stars: ✭ 34 (-52.11%)
Mutual labels:  inline
Amplify
A tiny script allowing inline image zoom
Stars: ✭ 458 (+545.07%)
Mutual labels:  inline
nova-inline-morph-to
A Laravel Nova field for displaying morphTo relationship inline.
Stars: ✭ 32 (-54.93%)
Mutual labels:  inline
editorjs-inline
Inline-Editor.js Tool for Editor.js
Stars: ✭ 23 (-67.61%)
Mutual labels:  inline
keyboa
Keyboa is a project designed to simplify Telegram keyboards creation.
Stars: ✭ 24 (-66.2%)
Mutual labels:  inline
js.metaret
lightweight mutual tail recursion optimization without trampoline
Stars: ✭ 16 (-77.46%)
Mutual labels:  inline
Template.scala
C++ Flavored Template Metaprogramming in Scala
Stars: ✭ 40 (-43.66%)
Mutual labels:  inline
inline-source-webpack-plugin
A webpack plugin to embed css/js resource in the html.
Stars: ✭ 18 (-74.65%)
Mutual labels:  inline
Youtube player flutter
Flutter plugin for playing or streaming YouTube videos inline using the official iFrame Player API. Supports both Android and iOS platforms.
Stars: ✭ 366 (+415.49%)
Mutual labels:  inline
node-inline-assets
Node API, CLI and Grunt Task for inlining external assets of HTML/CSS files
Stars: ✭ 18 (-74.65%)
Mutual labels:  inline
inline-critical
Inline critical path CSS and async load existing stylesheets
Stars: ✭ 106 (+49.3%)
Mutual labels:  inline
Email Templates
📫 Create, preview, and send custom email templates for Node.js. Highly configurable and supports automatic inline CSS, stylesheets, embedded images and fonts, and much more!
Stars: ✭ 3,291 (+4535.21%)
Mutual labels:  inline
Inlin-Craft
Plugin for inlining files in templates.
Stars: ✭ 64 (-9.86%)
Mutual labels:  inline
Java Diff Utils
Diff Utils library is an OpenSource library for performing the comparison / diff operations between texts or some kind of data: computing diffs, applying patches, generating unified diffs or parsing them, generating diff output for easy future displaying (like side-by-side view) and so on.
Stars: ✭ 670 (+843.66%)
Mutual labels:  inline
USERGE-X
USERGE-X. What the X ?
Stars: ✭ 133 (+87.32%)
Mutual labels:  inline
postcss-inline-base64
PostCSS plugin used to replace value inside of url function to base64
Stars: ✭ 23 (-67.61%)
Mutual labels:  inline
Svgpocketguide
All original content of A Pocket Guide to Writing SVG by Joni Trythall
Stars: ✭ 1,106 (+1457.75%)
Mutual labels:  inline
Inline Docs.el
Show inline contextual docs in Emacs.
Stars: ✭ 12 (-83.1%)
Mutual labels:  inline
Android Inline Youtube View
Utility library around using YouTube inside your android app.
Stars: ✭ 313 (+340.85%)
Mutual labels:  inline

ActionMailer Inline CSS TravisCI

Seamlessly integrate Alex Dunae's premailer gem with ActionMailer.

Problem?

Gmail doesn't support <style> or <link> tags for HTML emails. Other webmail clients also have problems with <link> tags.

This means that CSS must be inlined on each element, otherwise the email will not be displayed correctly in every client.

Solution

Inlining CSS is a pain to do by hand, and that's where the premailer gem comes in.

From http://premailer.dialect.ca/:

  • CSS styles are converted to inline style attributes. Checks style and link[rel=stylesheet] tags, and preserves existing inline attributes.
  • Relative paths are converted to absolute paths. Checks links in href, src and CSS url('')

This actionmailer_inline_css gem is a tiny integration between ActionMailer and premailer.

Inspiration comes from @fphilipe's premailer-rails3 gem, but I wasn't completely happy with it's conventions.

Installation & Usage

To use this in your Rails app, simply add gem "actionmailer_inline_css" to your Gemfile.

  • If you already have an HTML email template, all CSS will be automatically inlined.
  • If you don't include a text email template, premailer will generate one from the HTML part. (Having said that, it is recommended that you write your text templates by hand.)

NOTE:

The current version of premailer doesn't support UTF-8, so I have written a small workaround to enforce it. This works for both Ruby 1.9 and 1.8.

Including CSS in Mail Templates

You can use the stylesheet_link_tag helper to add stylesheets to your mailer layouts. actionmailer_inline_css contains a premailer override that properly handles these CSS URIs.

Example

Add the following line to the <head> section of app/views/layouts/build_mailer.html.erb:

<%= stylesheet_link_tag '/stylesheets/mailers/build_mailer' %>

This will add a stylesheet link for public/stylesheets/mailers/build_mailer.css. Premailer will then inline the CSS from that file, and remove the link tag.

More Info

See this Guide to CSS support in email from campaignmonitor.com for more info about CSS in emails.

Email Client Popularity:

Outlook 27.62%
iOS Devices 16.01%
Hotmail 12.14%
Apple Mail 11.13%
Yahoo! Mail 9.54%
Gmail 7.02%
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].