{"id":20555465,"url":"https://github.com/premailer/actionmailer_inline_css","last_synced_at":"2025-04-14T12:44:39.177Z","repository":{"id":1648697,"uuid":"2374370","full_name":"premailer/actionmailer_inline_css","owner":"premailer","description":"Seamlessly integrate Alex Dunae's premailer with ActionMailer.","archived":false,"fork":false,"pushed_at":"2017-10-11T04:14:00.000Z","size":43,"stargazers_count":76,"open_issues_count":5,"forks_count":25,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T01:53:34.301Z","etag":null,"topics":["actionmailer","css","inline","premailer"],"latest_commit_sha":null,"homepage":"http://madebynathan.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/premailer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-09-12T21:25:57.000Z","updated_at":"2025-01-25T00:48:15.000Z","dependencies_parsed_at":"2022-09-02T14:32:13.035Z","dependency_job_id":null,"html_url":"https://github.com/premailer/actionmailer_inline_css","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/premailer%2Factionmailer_inline_css","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/premailer%2Factionmailer_inline_css/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/premailer%2Factionmailer_inline_css/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/premailer%2Factionmailer_inline_css/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/premailer","download_url":"https://codeload.github.com/premailer/actionmailer_inline_css/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248883389,"owners_count":21177203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actionmailer","css","inline","premailer"],"created_at":"2024-11-16T03:18:29.460Z","updated_at":"2025-04-14T12:44:39.144Z","avatar_url":"https://github.com/premailer.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ActionMailer Inline CSS [![TravisCI](http://travis-ci.org/premailer/actionmailer_inline_css.png?branch=master)](http://travis-ci.org/premailer/actionmailer_inline_css)\n\nSeamlessly integrate [Alex Dunae's premailer](http://premailer.dialect.ca/) gem with ActionMailer.\n\n\n## Problem?\n\nGmail doesn't support `\u003cstyle\u003e` or `\u003clink\u003e` tags for HTML emails. Other webmail clients also\nhave problems with `\u003clink\u003e` tags.\n\nThis means that CSS must be inlined on each element, otherwise\nthe email will not be displayed correctly in every client.\n\n\n## Solution\n\nInlining CSS is a pain to do by hand, and that's where the\n[premailer](http://premailer.dialect.ca/) gem comes in.\n\nFrom http://premailer.dialect.ca/:\n\n* CSS styles are converted to inline style attributes.\n  Checks \u003ctt\u003estyle\u003c/tt\u003e and \u003ctt\u003elink[rel=stylesheet]\u003c/tt\u003e tags, and preserves existing inline attributes.\n* Relative paths are converted to absolute paths.\n  Checks links in \u003ctt\u003ehref\u003c/tt\u003e, \u003ctt\u003esrc\u003c/tt\u003e and CSS \u003ctt\u003eurl('')\u003c/tt\u003e\n\n\nThis \u003ctt\u003eactionmailer_inline_css\u003c/tt\u003e gem is a tiny integration between ActionMailer and premailer.\n\nInspiration comes from [@fphilipe](https://github.com/fphilipe)'s\n[premailer-rails3](https://github.com/fphilipe/premailer-rails3) gem, but I wasn't\ncompletely happy with it's conventions.\n\n\n## Installation \u0026 Usage\n\nTo use this in your Rails app, simply add `gem \"actionmailer_inline_css\"` to your `Gemfile`.\n\n* If you already have an HTML email template, all CSS will be automatically inlined.\n* If you don't include a text email template, \u003ctt\u003epremailer\u003c/tt\u003e will generate one from the HTML part.\n  (Having said that, it is recommended that you write your text templates by hand.)\n\n#### NOTE:\n\nThe current version of premailer doesn't support UTF-8, so I have written a small\nworkaround to enforce it. This works for both Ruby 1.9 and 1.8.\n\n\n### Including CSS in Mail Templates\n\nYou can use the `stylesheet_link_tag` helper to add stylesheets to your mailer layouts.\n\u003ctt\u003eactionmailer_inline_css\u003c/tt\u003e contains a \u003ctt\u003epremailer\u003c/tt\u003e override that properly handles\nthese CSS URIs.\n\n#### Example\n\nAdd the following line to the `\u003chead\u003e` section of \u003ctt\u003eapp/views/layouts/build_mailer.html.erb\u003c/tt\u003e:\n\n    \u003c%= stylesheet_link_tag '/stylesheets/mailers/build_mailer' %\u003e\n\nThis will add a stylesheet link for \u003ctt\u003epublic/stylesheets/mailers/build_mailer.css\u003c/tt\u003e.\nPremailer will then inline the CSS from that file, and remove the link tag.\n\n\n## More Info\n\nSee this [Guide to CSS support in email](http://www.campaignmonitor.com/css/) from\n[campaignmonitor.com](http://www.campaignmonitor.com) for more info about CSS in emails.\n\n\n### [Email Client Popularity](http://www.campaignmonitor.com/stats/email-clients/):\n\n| Outlook | 27.62% |\n|------:|:------------|\n| iOS Devices | 16.01% |\n| Hotmail | 12.14% |\n| Apple Mail | 11.13% |\n| Yahoo! Mail | 9.54% |\n| Gmail | 7.02% |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpremailer%2Factionmailer_inline_css","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpremailer%2Factionmailer_inline_css","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpremailer%2Factionmailer_inline_css/lists"}