md-roadie 2.4.2.md.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/.autotest +10 -0
  2. data/.gitignore +12 -0
  3. data/.travis.yml +22 -0
  4. data/.yardopts +1 -0
  5. data/Appraisals +15 -0
  6. data/Changelog.md +185 -0
  7. data/Gemfile +11 -0
  8. data/Guardfile +8 -0
  9. data/MIT-LICENSE +20 -0
  10. data/README.md +310 -0
  11. data/Rakefile +30 -0
  12. data/autotest/discover.rb +1 -0
  13. data/gemfiles/rails_3.0.gemfile +7 -0
  14. data/gemfiles/rails_3.0.gemfile.lock +123 -0
  15. data/gemfiles/rails_3.1.gemfile +7 -0
  16. data/gemfiles/rails_3.1.gemfile.lock +126 -0
  17. data/gemfiles/rails_3.2.gemfile +7 -0
  18. data/gemfiles/rails_3.2.gemfile.lock +124 -0
  19. data/gemfiles/rails_4.0.gemfile +7 -0
  20. data/gemfiles/rails_4.0.gemfile.lock +119 -0
  21. data/lib/roadie.rb +79 -0
  22. data/lib/roadie/action_mailer_extensions.rb +95 -0
  23. data/lib/roadie/asset_pipeline_provider.rb +28 -0
  24. data/lib/roadie/asset_provider.rb +62 -0
  25. data/lib/roadie/css_file_not_found.rb +22 -0
  26. data/lib/roadie/filesystem_provider.rb +74 -0
  27. data/lib/roadie/inliner.rb +251 -0
  28. data/lib/roadie/railtie.rb +39 -0
  29. data/lib/roadie/selector.rb +50 -0
  30. data/lib/roadie/style_declaration.rb +42 -0
  31. data/lib/roadie/version.rb +3 -0
  32. data/md-roadie.gemspec +36 -0
  33. data/spec/fixtures/app/assets/stylesheets/integration.css +10 -0
  34. data/spec/fixtures/public/stylesheets/integration.css +10 -0
  35. data/spec/fixtures/views/integration_mailer/marketing.html.erb +2 -0
  36. data/spec/fixtures/views/integration_mailer/notification.html.erb +8 -0
  37. data/spec/fixtures/views/integration_mailer/notification.text.erb +6 -0
  38. data/spec/integration_spec.rb +110 -0
  39. data/spec/lib/roadie/action_mailer_extensions_spec.rb +227 -0
  40. data/spec/lib/roadie/asset_pipeline_provider_spec.rb +65 -0
  41. data/spec/lib/roadie/css_file_not_found_spec.rb +29 -0
  42. data/spec/lib/roadie/filesystem_provider_spec.rb +94 -0
  43. data/spec/lib/roadie/inliner_spec.rb +591 -0
  44. data/spec/lib/roadie/selector_spec.rb +55 -0
  45. data/spec/lib/roadie/style_declaration_spec.rb +49 -0
  46. data/spec/lib/roadie_spec.rb +101 -0
  47. data/spec/shared_examples/asset_provider_examples.rb +11 -0
  48. data/spec/spec_helper.rb +69 -0
  49. data/spec/support/anonymous_mailer.rb +21 -0
  50. data/spec/support/change_url_options.rb +5 -0
  51. data/spec/support/have_attribute_matcher.rb +28 -0
  52. data/spec/support/have_node_matcher.rb +19 -0
  53. data/spec/support/have_selector_matcher.rb +6 -0
  54. data/spec/support/have_styling_matcher.rb +25 -0
  55. data/spec/support/parse_styling.rb +25 -0
  56. metadata +318 -0
@@ -0,0 +1,10 @@
1
+ # Override autotest default magic to rerun all tests every time a
2
+ # change is detected on the file system.
3
+ class Autotest
4
+ def get_to_green
5
+ begin
6
+ rerun_all_tests
7
+ wait_for_changes unless all_good
8
+ end until all_good
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ .DS_Store
2
+ pkg
3
+ .*~
4
+ .yardoc
5
+
6
+ .rspec
7
+ .idea/*
8
+ .rvmrc
9
+
10
+ Gemfile.lock
11
+ doc
12
+ tmp
@@ -0,0 +1,22 @@
1
+ bundler_args: --without guard
2
+ before_install:
3
+ - gem install bundler --pre
4
+
5
+ rvm:
6
+ - 1.8.7
7
+ - 1.9.3
8
+ - 2.0.0
9
+ - jruby
10
+
11
+ gemfile:
12
+ - gemfiles/rails_3.0.gemfile
13
+ - gemfiles/rails_3.1.gemfile
14
+ - gemfiles/rails_3.2.gemfile
15
+ - gemfiles/rails_4.0.gemfile
16
+
17
+ matrix:
18
+ exclude:
19
+ - rvm: 1.8.7
20
+ gemfile: gemfiles/rails_4.0.gemfile
21
+ allow_failures:
22
+ - rvm: jruby
@@ -0,0 +1 @@
1
+ --no-private
@@ -0,0 +1,15 @@
1
+ appraise 'rails-3.0' do
2
+ gem 'rails', '~> 3.0.0'
3
+ end
4
+
5
+ appraise 'rails-3.1' do
6
+ gem 'rails', '~> 3.1.0'
7
+ end
8
+
9
+ appraise 'rails-3.2' do
10
+ gem 'rails', '~> 3.2.0'
11
+ end
12
+
13
+ appraise 'rails-4.0' do
14
+ gem 'rails', '~> 4.0'
15
+ end
@@ -0,0 +1,185 @@
1
+ ### dev
2
+
3
+ [full changelog](https://github.com/Mange/roadie/compare/v2.4.2...master)
4
+
5
+ * Nothing yet
6
+
7
+ ### 2.4.2
8
+
9
+ [full changelog](https://github.com/Mange/roadie/compare/v2.4.1...v2.4.2)
10
+
11
+ * Bug fixes:
12
+ * Fix Nokogiri version to allow only 1.5.x on ruby 1.8.7
13
+ * Blacklist :before, :after, :-ms-input-placeholder, :-moz-placeholder selectors – [Brian Bauer (bbauer)][https://github.com/bbauer].
14
+ * Build failed on 1.8.7 due to a change in `css_parser`
15
+
16
+ ### 2.4.1
17
+
18
+ [full changelog](https://github.com/Mange/roadie/compare/v2.4.0...v2.4.1)
19
+
20
+ * Bug fixes:
21
+ * Allow Nokogiri 1.5.x again; 1.6.x is unsupported in Ruby 1.8.7.
22
+
23
+ ### 2.4.0
24
+
25
+ [full changelog](https://github.com/Mange/roadie/compare/v2.3.4...v2.4.0)
26
+
27
+ * Enhancements:
28
+ * Support Rails 4.0, with the help of:
29
+ * [Ryunosuke SATO (tricknotes)](https://github.com/tricknotes)
30
+ * [Dylan Markow](https://github.com/dmarkow)
31
+ * Keep `!important` when outputting styles to help combat web mail styles being `!important`
32
+ * Support `:nth-child`, `:last-child`, etc.
33
+ * To make this work, Roadie have to catch errors from Nokogiri and ignore them. A warning will be printed when this happens so users can open issues with the project and tests can be expanded.
34
+ * Support for custom inliner (#58) — [Harish Shetty (kandadaboggu)](https://github.com/kandadaboggu) with friends
35
+ * Bug fixes:
36
+ * Don't crash when URL options have protocols with "://" in them (#52).
37
+ * Other:
38
+ * Be more specific on which versions are required; require newer `css_parser`
39
+ * Officially support MRI 2.0.0
40
+ * Add experimental support for JRuby
41
+ * Remove documentation that talks about passing CSS filenames as symbols; unsupported in Rails 4. (Thanks to [PikachuEXE](https://github.com/PikachuEXE))
42
+
43
+ ### 2.3.4
44
+
45
+ [full changelog](https://github.com/Mange/roadie/compare/v2.3.3...v2.3.4)
46
+
47
+ * Enhancements:
48
+ * Add `config.roadie.enabled` that can be set to `false` to disable Roadie completely.
49
+ * Bug fixes:
50
+ * Proc objects to the `:css` option is now run in the context of the mailer instance, mirroring similar options from ActionMailer.
51
+ * Fix some tests that would always pass
52
+ * Improve JRuby compatibility
53
+ * Update Gemfile.lock and fix issues with newer gem versions
54
+
55
+ ### 2.3.3
56
+
57
+ [full changelog](https://github.com/Mange/roadie/compare/v2.3.2...v2.3.3)
58
+
59
+ * Enhancements:
60
+ * Allow proc objects to the `:css` option
61
+ * Bug fixes:
62
+ * Ignore HTML comments and CDATA sections in CSS (support TinyMCE)
63
+
64
+ ### 2.3.2
65
+
66
+ [full changelog](https://github.com/Mange/roadie/compare/v2.3.1...v2.3.2)
67
+
68
+ * Bug fixes:
69
+ * Don't fail on selectors which start with @ (#28) — [Roman Shterenzon (romanbsd)](https://github.com/romanbsd)
70
+
71
+ ### 2.3.1
72
+
73
+ [full changelog](https://github.com/Mange/roadie/compare/v2.3.0...v2.3.1)
74
+
75
+ * Bug fixes:
76
+ * Does not work with Rails 3.0 unless provider set specifically (#23)
77
+
78
+ ### 2.3.0
79
+
80
+ [full changelog](https://github.com/Mange/roadie/compare/v2.3.0.pre1...v2.3.0)
81
+
82
+ * Nothing, really
83
+
84
+ ### 2.3.0.pre1
85
+
86
+ [full changelog](https://github.com/Mange/roadie/compare/v2.2.0...v2.3.0.pre1)
87
+
88
+ * Enhancements:
89
+ * Support Rails 3.2.pre1 - [Morton Jonuschat (yabawock)](https://github.com/yabawock)
90
+ * Sped up the Travis builds
91
+ * Official support for Rails 3.0 again
92
+ * Dependencies allow 3.0
93
+ * Travis builds 3.0 among the others
94
+
95
+ ### 2.2.0
96
+
97
+ [full changelog](https://github.com/Mange/roadie/compare/v2.1.0...v2.2.0)
98
+
99
+ * Enhancements:
100
+ * Support for the `url_options` method inside mailer instances
101
+ * You can now dynamically alter the URL options on a per-email basis
102
+
103
+ ### 2.1.0
104
+
105
+ [full changelog](https://github.com/Mange/roadie/compare/v2.1.0.pre2...v2.1.0)
106
+
107
+ * Full release!
108
+
109
+ ### 2.1.0.pre2
110
+
111
+ [full changelog](https://github.com/Mange/roadie/compare/v2.1.0.pre1...v2.1.0.pre2)
112
+
113
+ * Bug: Roadie broke `url_for` inside mailer views
114
+
115
+ ### 2.1.0.pre1
116
+
117
+ [full changelog](https://github.com/Mange/roadie/compare/v2.0.0...v2.1.0.pre1)
118
+
119
+ * Enhancements:
120
+ * Support normal filesystem instead of only Asset pipeline
121
+ * Enable users to create their own way of fetching CSS
122
+ * Improve test coverage a bit
123
+ * Use a railtie to hook into Rails
124
+ * Use real Rails for testing integration
125
+
126
+ ### 2.0.0
127
+
128
+ [full changelog](https://github.com/Mange/roadie/compare/v1.1.3...v2.0.0)
129
+
130
+ * Enhancements:
131
+ * Support the Asset pipeline - [Arttu Tervo (arttu)](https://github.com/arttu)
132
+ * Dependencies:
133
+ * Requires Rails 3.1 to work. You can keep on using the 1.x series in Rails 3.0
134
+
135
+ ### 1.1.3
136
+
137
+ [full changelog](https://github.com/Mange/roadie/compare/v1.1.2...v1.1.3)
138
+
139
+ * Do not add another ".css" to filenames if already present - [Aliaxandr (saks)](https://github.com/saks)
140
+
141
+ ### 1.1.2
142
+
143
+ [full changelog](https://github.com/Mange/roadie/compare/v1.1.1...v1.1.2)
144
+
145
+ * Support for Rails 3.1.0 and later inside gemspec
146
+
147
+ ### 1.1.1
148
+
149
+ [full changelog](https://github.com/Mange/roadie/compare/v1.1.0...v1.1.1)
150
+
151
+ * Support for Rails 3.1.x (up to and including RC4)
152
+ * Rails 3.0.x is still supported
153
+ * Added CI via [Travis CI](http://travis-ci.org)
154
+
155
+ ### 1.1.0
156
+
157
+ [full changelog](https://github.com/Mange/roadie/compare/v1.0.1...v1.1.0)
158
+
159
+ * Enhancements:
160
+ * Support for inlining `<link>` elements (thanks to [aliix](https://github.com/aliix))
161
+
162
+ ### 1.0.1
163
+
164
+ [full changelog](https://github.com/Mange/roadie/compare/v1.0.0...v1.0.1)
165
+
166
+ * Enhancements:
167
+ * Full, official support for Ruby 1.9.2 (in addition to 1.8.7)
168
+ * Dependencies:
169
+ * Explicilty depend on nokogiri >= 1.4.4
170
+
171
+ ### 1.0.0
172
+
173
+ [full changelog](https://github.com/Mange/roadie/compare/legacy...v1.0.0)
174
+
175
+ Roadie fork!
176
+
177
+ * Enhancements:
178
+ * Support for Rails 3.0
179
+ * Code cleanup
180
+ * Support `!important`
181
+ * Tests
182
+ * + some other enhancements
183
+ * Deprecations:
184
+ * Removed support for Rails 2.x
185
+
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
4
+ group :guard do
5
+ gem 'guard'
6
+ gem 'guard-rspec'
7
+
8
+ # Guard for Mac
9
+ gem 'rb-fsevent', '>= 0.9.0.pre5'
10
+ gem 'growl'
11
+ end
@@ -0,0 +1,8 @@
1
+ guard 'rspec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
+
5
+ watch(%r{spec/support/.*\.rb}) { "spec" }
6
+ watch('spec/spec_helper.rb') { "spec" }
7
+ end
8
+
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Jim Neath / Purify
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,310 @@
1
+ Roadie
2
+ ======
3
+
4
+ > Making HTML emails comfortable for the Rails rockstars
5
+
6
+ Roadie tries to make sending HTML emails a little less painful in Rails 3+ by inlining stylesheets and rewrite relative URLs for you.
7
+
8
+ If you want to have this in Rails 2, please see [MailStyle](https://www.github.com/purify/mail_style).
9
+
10
+ How does it work?
11
+ -----------------
12
+
13
+ Email clients have bad support for stylesheets, and some of them blocks stylesheets from downloading. The easiest way to handle this is to work with all styles inline, but that is error prone and hard to work with as you cannot use classes and/or reuse styling.
14
+
15
+ This gem helps making this easier by automatically inlining stylesheet rules into the document before sending it. You just give it a list of stylesheets and it will go though all of the selectors assigning the styles to the maching elements. Careful attention has been put into rules being applied in the correct order, so it should behave just like in the browser¹.
16
+
17
+ Roadie also rewrites all relative URLs in the email to a absolute counterpart, making images you insert and those referenced in your stylesheets work. No more headaches about how to write the stylesheets while still having them work with emails from your acceptance environments.
18
+
19
+ ¹: Of course, rules like `:hover` will not work by definition. Only static styles can be added.
20
+
21
+ Build Status
22
+ ------------
23
+
24
+ [![Build history and status](https://secure.travis-ci.org/Mange/roadie.png)](http://travis-ci.org/#!/Mange/roadie)
25
+
26
+ Tested with [Travis CI](http://travis-ci.org) using [almost all combinations of](http://travis-ci.org/#!/Mange/roadie):
27
+
28
+ * Ruby:
29
+ * MRI 1.8.7
30
+ * MRI 1.9.3
31
+ * MRI 2.0.0
32
+ * Rails
33
+ * 3.0
34
+ * 3.1
35
+ * 3.2
36
+ * 4.0
37
+
38
+ Let me know if you want any other combination supported officially.
39
+
40
+ ### Versioning ###
41
+
42
+ This project follows [Semantic Versioning](http://semver.org/) and has been since version 1.0.0.
43
+
44
+ Features
45
+ --------
46
+
47
+ * Supports Rails' Asset Pipeline and simple filesystem access out of the box
48
+ * You can add support for CSS from any place inside your apps
49
+ * Writes CSS styles inline
50
+ * Respects `!important` styles
51
+ * Does not overwrite styles already present in the `style` attribute of tags
52
+ * Supports the same CSS selectors as [Nokogiri](http://nokogiri.org/) (use CSS3 selectors in your emails!)
53
+ * Makes image urls absolute
54
+ * Hostname and port configurable on a per-environment basis
55
+ * Makes link `href`s absolute
56
+ * Automatically adds proper html skeleton when missing (you don't have to create a layout for emails)²
57
+
58
+ ²: This might be removed in a future version, though. You really ought to create a good layout and not let Roadie guess how you want to have it structured
59
+
60
+ Install
61
+ -------
62
+
63
+ Add the gem to Rails' Gemfile
64
+
65
+ ```ruby
66
+ gem 'roadie'
67
+ ```
68
+
69
+ Configuring
70
+ -----------
71
+
72
+ Roadie listens to the following options (set in `Application.rb` or in your environment's configuration files:
73
+
74
+ * `config.roadie.enabled` - Set this to `false` to disable Roadie from working on your emails. Useful if you want to disable Roadie in some environments.
75
+ * `config.action_mailer.default_url_options` - Used for making URLs absolute.
76
+ * `config.assets.enabled` - If the asset pipeline is turned off, Roadie will default to searching for assets in `public/stylesheets`.
77
+ * `config.roadie.provider` - Set the provider manually, ignoring all other options. Use for advanced cases, or when you have non-default paths or other options.
78
+ * `config.roadie.after_inlining` - Set a custom inliner for the HTML document. The custom inliner in invoked after the default inliner.
79
+
80
+ Usage
81
+ -----
82
+
83
+ Just add a `<link rel="stylesheet" />` or `<style type="text/css"></style>` element inside your email layout and it will be inlined automatically.
84
+
85
+ **Note:** Do not use `stylesheet_link_tag` in your mail views. Just use a regular tag pointing to the logical asset name instead; e.g. `emails.css` instead of `emails-<SHA>.css`. This should hopefully be fixed in a later version. You are recommended to use the `:css` option to the mailer (detailed below) instead if you want to avoid problems with this.
86
+
87
+ You can also specify the `:css` option to mailer to have it inlined automatically without you having to make a layout:
88
+
89
+ ```ruby
90
+ class Notifier < ActionMailer::Base
91
+ default :css => 'email', :from => 'support@mycompany.com'
92
+
93
+ def registration_mail
94
+ mail(:subject => 'Welcome Aboard', :to => 'someone@example.com')
95
+ end
96
+
97
+ def newsletter
98
+ mail(:subject => 'Newsletter', :to => 'someone@example.com', :css => ['email', 'newsletter'])
99
+ end
100
+ end
101
+ ```
102
+
103
+ This will look for a css file called `email.css` in your assets. The `css` method can take either a string or an array of strings. The ".css" extension will be added automatically.
104
+
105
+ ### Image URL rewriting ###
106
+
107
+ If you have `default_url_options[:host]` set in your mailer, then Roadie will do it's best to make the URLs of images and in stylesheets absolute.
108
+
109
+ In `application.rb`:
110
+
111
+ ```ruby
112
+ class Application
113
+ config.action_mailer.default_url_options = {:host => 'example.com'}
114
+ end
115
+ ```
116
+
117
+ If you want to to be different depending on your environment, just set it in your environment's configuration instead.
118
+
119
+ ### Ignoring stylesheets ###
120
+
121
+ By default, `style` and `link` elements in the email document's `head` are processed along with the stylesheets and removed from the `head`.
122
+
123
+ You can set a special `data-immutable="true"` attribute on `style` and `link` tags you do not want to be processed and removed from the document's `head`. This is the place to put things like `:hover` selectors that you want to have for email clients allowing them.
124
+
125
+ Style and link elements with `media="print"` are always ignored.
126
+
127
+ ### Inlining link tags ###
128
+
129
+ Any `link` element that is part of your email will be linked in. You can exclude them by setting `data-immutable` as you would on normal `style` elements. Linked stylesheets for print media is also ignored as you would expect.
130
+
131
+ If the `link` tag uses an absolute URL to the stylesheet, it will not be inlined. Use a relative path instead:
132
+
133
+ ```html
134
+ <head>
135
+ <link rel="stylesheet" type="text/css" href="/assets/emails/rock.css"> <!-- Will be inlined -->
136
+ <link rel="stylesheet" type="text/css" href="http://www.metal.org/metal.css"> <!-- Will NOT be inlined -->
137
+ <link rel="stylesheet" type="text/css" href="/assets/jazz.css" media="print"> <!-- Will NOT be inlined -->
138
+ <link rel="stylesheet" type="text/css" href="/ambient.css" data-immutable> <!-- Will NOT be inlined -->
139
+ </head>
140
+ ```
141
+
142
+ Writing your own provider
143
+ -------------------------
144
+
145
+ A provider handles searching CSS files for you. You can easily create your own provider for your specific app by subclassing `Roadie::AssetProvider`. See the API documentation for information about how to build them.
146
+
147
+ Example Subclassing the `AssetPipelineProvider`:
148
+
149
+ ```ruby
150
+ # application.rb
151
+ config.roadie.provider = UserAssetsProvider.new
152
+
153
+ # lib/user_assets_provider.rb
154
+ class UserAssetsProvider < Roadie::AssetPipelineProvider
155
+ def find(name)
156
+ user = User.find_by_name(name)
157
+ if user
158
+ user.custom_css
159
+ else
160
+ super
161
+ end
162
+ end
163
+ end
164
+ ```
165
+
166
+ Writing your own inliner
167
+ -------------------------
168
+
169
+ A custom inliner transforms an outgoing HTML email using application specific rules. The custom inliner is invoked after the default inliner.
170
+
171
+ A custom inliner can be created using a `lambda` that accepts one parameter or an object that responds to the `call` method with one parameter.
172
+
173
+ Example for using lambda as custom inliner:
174
+
175
+ ```ruby
176
+ # application.rb
177
+ config.roadie.after_inlining = lambda do |document|
178
+ document.css("a#new_user").each do |link|
179
+ link['href'] = "http://www.foo.com#{link['href']}"
180
+ end
181
+ end
182
+ ```
183
+
184
+ Example for using object as custom inliner:
185
+
186
+ ```ruby
187
+ # application.rb
188
+ config.roadie.after_inlining = PromotionInliner.new
189
+
190
+ # lib/product_link_inliner.rb
191
+ class PromotionInliner
192
+ def call(document)
193
+ document.css("a.product").each do |link|
194
+ fix_link link
195
+ end
196
+ end
197
+
198
+ def fix_link(link)
199
+ if link['class'] =~ /\bsale\b/
200
+ link['href'] = link['href'] + '?source=newsletter'
201
+ end
202
+ end
203
+ end
204
+ ```
205
+
206
+ ### Custom inliner scopes
207
+
208
+ - **All HTML emails**
209
+
210
+ ```ruby
211
+ # application.rb. Custom inliner for all emails.
212
+ config.roadie.after_inlining = PromotionInliner.new
213
+ ```
214
+ - **All HTML emails sent by a mailer**
215
+
216
+ ```ruby
217
+ class MarketingMailer < ActionMailer::Base
218
+ # Custom inliner for all mailer methods.
219
+ default after_inlining: PromotionInliner.new
220
+ end
221
+ ```
222
+
223
+ - **All HTML emails sent by a specific mailer method**
224
+
225
+ ```ruby
226
+ class UserMailer < ActionMailer::Base
227
+ def registration
228
+ # Custom inliner for registration emails
229
+ mail(after_inlining: MarketingMailer.new)
230
+ end
231
+ end
232
+ ```
233
+
234
+ Bugs / TODO
235
+ -----------
236
+
237
+ * Improve overall performance
238
+ * Clean up stylesheet assignment code
239
+ * Assets referenced with digest URLs should be findable
240
+ * Roadie should be able to have multiple asset providers in a specific order
241
+
242
+ FAQ
243
+ ---
244
+
245
+ ### I'm getting segmentation faults (or other C-like problems)! What should I do? ###
246
+
247
+ Roadie uses Nokogiri to parse the HTML of your email, so any C-like problems like segfaults are likely in that end. The best way to fix this is to first upgrade libxml2 on your system and then reinstall Nokogiri.
248
+ Instructions on how to do this on most platforms, see [Nokogiri's official install guide](http://nokogiri.org/tutorials/installing_nokogiri.html).
249
+
250
+ ### My `:hover` selectors don't work. How can I fix them? ###
251
+
252
+ Put any styles using `:hover` in a separate stylesheet and make sure it is ignored. (See "Ignoring stylesheets" above)
253
+
254
+ ### My `@media` queries don't work. How can I fix them? ###
255
+
256
+ Put any styles using them in a separate stylesheet and make sure it is ignored. (See "Ignoring stylesheets" above)
257
+
258
+ ### My vendor-specific styles don't work. How can I fix them? ###
259
+
260
+ Put any styles using them in a separate stylesheet and make sure it is ignored. (See "Ignoring stylesheets" above)
261
+
262
+ Documentation
263
+ -------------
264
+
265
+ * [Online documentation for 2.3.0](http://rubydoc.info/gems/roadie/2.3.0/frames)
266
+ * [Online documentation for master](http://rubydoc.info/github/Mange/roadie/master/frames)
267
+ * [Changelog](https://github.com/Mange/roadie/blob/master/Changelog.md)
268
+
269
+ Running specs
270
+ -------------
271
+
272
+ Run specs for your current ruby against the latest compatible version of rails with `rake spec`. You can run against all supported combinations of ruby and rails by issuing `rake spec:all`.
273
+
274
+ History and contributors
275
+ ------------------------
276
+
277
+ Major contributors to Roadie:
278
+
279
+ * [Arttu Tervo (arttu)](https://github.com/arttu) - Original Asset pipeline support
280
+ * [Ryunosuke SATO (tricknotes)](https://github.com/tricknotes) - Initial Rails 4 support
281
+
282
+ You can [see all contributors](https://github.com/Mange/roadie/contributors) on GitHub.
283
+
284
+ This gem was originally developed for Rails 2 use on [Purify](http://purifyapp.com) under the name [MailStyle](https://www.github.com/purify/mail_style). However, the author stopped maintaining it and a fork took place to make it Rails 3+ compatible.
285
+
286
+ The following people have contributed to the orignal gem:
287
+
288
+ * [Jim Neath](http://jimneath.org) (Original author)
289
+ * [Lars Klevans](http://tastybyte.blogspot.com/)
290
+ * [Jonas Grimfelt](http://github.com/grimen)
291
+ * [Ben Johnson](http://www.binarylogic.com)
292
+ * [Istvan Hoka](http://istvanhoka.com/)
293
+ * [Voraz](http://blog.voraz.com.br)
294
+
295
+ License
296
+ -------
297
+
298
+ (The MIT License)
299
+
300
+ Copyright (c) 2009-2013
301
+
302
+ * [Jim Neath](http://jimneath.org)
303
+ * Magnus Bergmark <magnus.bergmark@gmail.com>
304
+
305
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
306
+
307
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
308
+
309
+ THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
310
+