A Ruby gem that automatically inlines CSS into HTML emails for ActionMailer, making styled emails work across all clients.
premailer-rails is a Ruby gem that automatically inlines CSS into HTML emails sent via ActionMailer. It solves the problem of email clients ignoring linked stylesheets by converting CSS rules into inline styles, allowing developers to maintain separate HTML and CSS files just like in web development.
Ruby developers using ActionMailer (in Rails or other frameworks) who need to send styled HTML emails that render consistently across email clients.
It provides a zero-configuration, drop-in solution that handles the tedious work of CSS inlining automatically, supports multiple CSS sourcing strategies, and works both inside and outside Rails environments.
CSS styled emails without the hassle.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Automatically hooks into ActionMailer to process all outgoing emails upon delivery, requiring no manual setup—just add the gem to your Gemfile, as described in the 'How It Works' section.
Supports multiple CSS sourcing methods including filesystem, Rails asset pipeline, and network (CDN), allowing seamless integration with various deployment setups, per the configuration details.
Works not only with Rails but also with Sinatra or any framework using ActionMailer, as highlighted in the introduction, making it versatile for Ruby ecosystems.
Includes caching of CSS in production Rails environments to improve efficiency, reducing repeated processing for the same stylesheets, mentioned in the 'How It Works' section.
Requires additional gems like premailer and an HTML parser (e.g., nokogiri), which increases bundle size and can lead to version conflicts, as noted in the 'Installation' section.
The skip_premailer header behaves unintuitively—even setting it to false skips processing due to string conversion, a quirk admitted in the 'Usage' section that can cause errors.
Integration with tools like Webpacker requires manual configuration and workarounds, as referenced in the 'Supported Rails Versions' section with a link to a GitHub issue, adding complexity.