Mange / roadie

Making HTML emails comfortable for the Ruby rockstars

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

css parser chokes on @ type selectors

romanbsd opened this issue · comments

For instance, the Twitter's bootstrap.css has the following selector:

@-webkit-keyframes progress-bar-stripes {
  from {
    background-position: 40px 0;
  }
  to {
    background-position: 0 0;
  }
}

the workaround I have right now is the following:

--- a/lib/roadie/inliner.rb
+++ b/lib/roadie/inliner.rb
@@ -143,7 +143,7 @@ module Roadie
       end

       def each_selector_without_psuedo(rules)
-        rules.selectors.reject { |selector| selector.include?(':') }.each do |selector|
+        rules.selectors.reject { |selector| selector.include?(':') or selector.starts_with?('@') }.each do |selector|
           yield selector, CssParser.calculate_specificity(selector)
         end
       end

Would you mind opening a pull request with this fix along with some tests?

If you follow proper commit guidelines (general Git) and I'm happy about the tests, I'll accept it right away.

I wasn't sure that it's a proper fix for this issue.

I just released version 2.3.2 with this fix. Thank you for your contribution!