HtmlInlineCss
This gem was created to inline css in html mails for Pustomer.com but can be used anywhere you want to inline css.
Be aware that the gem not yet is ready for production. Feel free to fork and build upon it yourself.
Installation
Add this line to your application's Gemfile:
gem 'html_inline_css'
And then execute:
$ bundle
Or install it yourself as:
$ gem install html_inline_css
Usage
html = "<html><head><style>div {border: 1px solid #e5e5e5;}</style></head><body><div> Foo bar </div></body></html>"
html_with_inline_css = InlineCssString::CSS.inline_css(html)
html_with_inline_css => "<div style='border:1px solid #e5e5e5;'> Foo Bar </div>"
Be aware that the "InlineCssString::CSS.inline_css(string)" will remove all ,
,