premailer-rails 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.gitignore +1 -0
- data/Gemfile +1 -2
- data/README.md +10 -21
- data/VERSION +1 -1
- data/lib/premailer/rails.rb +1 -0
- data/lib/premailer/rails/css_helper.rb +0 -4
- data/lib/premailer/rails/hook.rb +104 -31
- data/lib/premailer/rails/nokogiri_fix.rb +2 -0
- data/premailer-rails.gemspec +1 -0
- data/spec/fixtures/message.rb +34 -10
- data/spec/lib/hook_registration_spec.rb +1 -1
- data/spec/lib/hook_spec.rb +53 -81
- data/spec/spec_helper.rb +7 -0
- metadata +17 -4
- data/lib/premailer/rails/premailer.rb +0 -20
- data/lib/premailer/rails3.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41073202cdcfc614302e4ebd78983e637bca0509
|
4
|
+
data.tar.gz: e6cffc67a632087c4403ae5ae3bc315f6949bcee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af6af666d40e0d924d3a8982fd240d407d9b5f01e8295d03c7aaa411285876ef23c03dc54aad10e0c4e0e28caa0c5132f7d0230c74edf0828e79664e1b30bf37
|
7
|
+
data.tar.gz: e1b3fa698a622be4fe6fd1bd18d9407dbac7823417fc0bf251adda5af9f096dec35fdbbca0f055dc5754fe7de763db3e541cfd84edbf0180d44a8d81012ffcbd
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,14 +4,12 @@
|
|
4
4
|
[](http://badge.fury.io/rb/premailer-rails)
|
5
5
|
[](https://gemnasium.com/fphilipe/premailer-rails)
|
6
6
|
[](https://codeclimate.com/github/fphilipe/premailer-rails)
|
7
|
+
[](https://coveralls.io/r/fphilipe/premailer-rails)
|
7
8
|
|
8
|
-
This gem is a no config solution for the wonderful
|
9
|
-
|
10
|
-
It uses interceptors which were introduced in Rails 3 and tweaks all mails which
|
11
|
-
are `deliver`ed and adds a plain text part to them and inlines all CSS rules
|
12
|
-
into the HTML part.
|
9
|
+
This gem is a no config solution for the wonderful [Premailer gem](https://github.com/alexdunae/premailer) to be used with Rails.
|
10
|
+
It uses interceptors which were introduced in Rails 3 and tweaks all mails which are `deliver`ed and adds a plain text part to them and inlines all CSS rules into the HTML part.
|
13
11
|
|
14
|
-
By default it inlines all the CSS files that are linked to in the HTML:
|
12
|
+
By default it inlines all inline `<style>` declarations and all the CSS files that are linked to in the HTML:
|
15
13
|
|
16
14
|
```html
|
17
15
|
<link type='text/css' ... />
|
@@ -19,7 +17,6 @@ By default it inlines all the CSS files that are linked to in the HTML:
|
|
19
17
|
|
20
18
|
Don't worry about the host in the CSS URL since this will be ignored.
|
21
19
|
|
22
|
-
Every CSS file is loaded from within the app.
|
23
20
|
The retrieval of the file depends on your assets configuration:
|
24
21
|
|
25
22
|
* Rails 3.1 asset pipeline: It will load the compiled version of the CSS asset
|
@@ -30,18 +27,13 @@ The retrieval of the file depends on your assets configuration:
|
|
30
27
|
* Classic static assets: It will try to load the CSS file located in
|
31
28
|
`public/stylesheets/`
|
32
29
|
|
33
|
-
* [Hassle](https://github.com/pedro/hassle): It will try to load the
|
34
|
-
compiled CSS file located in the default Hassle location
|
35
|
-
`tmp/hassle/stylesheets/`
|
36
|
-
|
37
30
|
## Installation
|
38
31
|
|
39
32
|
Simply add the gem to your Gemfile in your Rails project:
|
40
33
|
|
41
34
|
gem 'premailer-rails'
|
42
35
|
|
43
|
-
premailer-rails requires either nokogiri or hpricot. It doesn't list them as a
|
44
|
-
dependency so you can choose which one to use.
|
36
|
+
premailer-rails requires either nokogiri or hpricot. It doesn't list them as a dependency so you can choose which one to use.
|
45
37
|
|
46
38
|
gem 'nokogiri'
|
47
39
|
# or
|
@@ -74,13 +66,10 @@ The default configs are:
|
|
74
66
|
}
|
75
67
|
```
|
76
68
|
|
77
|
-
The input encoding option [changed](https://github.com/alexdunae/premailer/commit/5f5cbb4ac181299a7e73d3eca11f3cf546585364)
|
78
|
-
|
79
|
-
|
80
|
-
encoding make sure to specify the right one or both.
|
69
|
+
The input encoding option [changed](https://github.com/alexdunae/premailer/commit/5f5cbb4ac181299a7e73d3eca11f3cf546585364) at some point.
|
70
|
+
To make sure this option works regardless of the premailer version, the old and new setting is specified.
|
71
|
+
If you want to use another encoding make sure to specify the right one or both.
|
81
72
|
|
82
|
-
If you don't want to generate a text part from the html part, set the config
|
83
|
-
`:generate_text_part` to false.
|
73
|
+
If you don't want to automatically generate a text part from the html part, set the config `:generate_text_part` to false.
|
84
74
|
|
85
|
-
Note that the options `:with_html_string` and `:css_string` are used
|
86
|
-
this gem work and will thus be overridden.
|
75
|
+
Note that the options `:with_html_string` and `:css_string` are used internally and thus will be overridden.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.0
|
data/lib/premailer/rails.rb
CHANGED
data/lib/premailer/rails/hook.rb
CHANGED
@@ -1,42 +1,115 @@
|
|
1
1
|
class Premailer
|
2
2
|
module Rails
|
3
3
|
class Hook
|
4
|
+
attr_reader :message
|
5
|
+
|
4
6
|
def self.delivering_email(message)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
needs_multipart = Rails.config[:generate_text_part]
|
7
|
+
self.new(message).perform
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize(message)
|
11
|
+
@message = message
|
12
|
+
end
|
13
|
+
|
14
|
+
def perform
|
15
|
+
if message_contains_html?
|
16
|
+
replace_html_part(generate_html_part_replacement)
|
16
17
|
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
19
|
+
message
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def message_contains_html?
|
25
|
+
html_part.present?
|
26
|
+
end
|
27
|
+
|
28
|
+
# Returns true if the message itself has a content type of text/html, thus
|
29
|
+
# it does not contain other parts such as alternatives and attachments.
|
30
|
+
def pure_html_message?
|
31
|
+
message.content_type.include?('text/html')
|
32
|
+
end
|
33
|
+
|
34
|
+
def generate_html_part_replacement
|
35
|
+
if generate_text_part?
|
36
|
+
generate_alternative_part
|
37
|
+
else
|
38
|
+
generate_html_part
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def generate_text_part?
|
43
|
+
Rails.config[:generate_text_part] && !message.text_part
|
44
|
+
end
|
45
|
+
|
46
|
+
def generate_alternative_part
|
47
|
+
part = Mail::Part.new(:content_type => 'multipart/alternative')
|
48
|
+
part.add_part(generate_html_part)
|
49
|
+
part.add_part(generate_text_part)
|
50
|
+
|
51
|
+
part
|
52
|
+
end
|
53
|
+
|
54
|
+
def generate_html_part
|
55
|
+
# Make sure that the text part is generated first. Otherwise the text
|
56
|
+
# can end up containing CSS rules.
|
57
|
+
generate_text_part if generate_text_part?
|
58
|
+
|
59
|
+
Mail::Part.new(
|
60
|
+
:content_type => "text/html; charset=#{html_part.charset}",
|
61
|
+
:body => premailer.to_inline_css)
|
62
|
+
end
|
63
|
+
|
64
|
+
def generate_text_part
|
65
|
+
@text_part ||= Mail::Part.new(
|
66
|
+
:content_type => "text/plain; charset=#{html_part.charset}",
|
67
|
+
:body => premailer.to_plain_text)
|
68
|
+
end
|
69
|
+
|
70
|
+
def premailer
|
71
|
+
@premailer ||= CustomizedPremailer.new(html_part.body.to_s)
|
72
|
+
end
|
73
|
+
|
74
|
+
def html_part
|
75
|
+
if pure_html_message?
|
76
|
+
message
|
77
|
+
else
|
78
|
+
message.html_part
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def replace_html_part(new_part)
|
83
|
+
if pure_html_message?
|
84
|
+
replace_in_pure_html_message(new_part)
|
85
|
+
else
|
86
|
+
replace_part_in_list(message.parts, html_part, new_part)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# If the new part is a pure text/html part, the body and its content type
|
91
|
+
# are used for the message. If the new part is
|
92
|
+
def replace_in_pure_html_message(new_part)
|
93
|
+
if new_part.content_type.include?('text/html')
|
94
|
+
message.body = new_part.body.to_s
|
95
|
+
message.content_type = new_part.content_type
|
96
|
+
else
|
97
|
+
message.body = nil
|
98
|
+
message.content_type = new_part.content_type
|
99
|
+
new_part.parts.each do |part|
|
100
|
+
message.add_part(part)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
33
104
|
|
34
|
-
|
35
|
-
|
36
|
-
|
105
|
+
def replace_part_in_list(parts_list, old_part, new_part)
|
106
|
+
if (index = parts_list.index(old_part))
|
107
|
+
parts_list[index] = new_part
|
108
|
+
else
|
109
|
+
parts_list.any? do |part|
|
110
|
+
if part.respond_to?(:parts)
|
111
|
+
replace_part_in_list(part.parts, old_part, new_part)
|
37
112
|
end
|
38
|
-
else
|
39
|
-
message.body = premailer.to_inline_css
|
40
113
|
end
|
41
114
|
end
|
42
115
|
end
|
data/premailer-rails.gemspec
CHANGED
data/spec/fixtures/message.rb
CHANGED
@@ -44,17 +44,39 @@ nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
44
44
|
TEXT
|
45
45
|
|
46
46
|
def with_parts(*part_types)
|
47
|
+
if part_types.count == 1 and [:html, :text].include?(part_types.first)
|
48
|
+
return with_body(part_types.first)
|
49
|
+
end
|
50
|
+
|
47
51
|
message = base_message
|
52
|
+
content_part = message
|
53
|
+
|
54
|
+
if part_types.include?(:html) and part_types.include?(:text)
|
55
|
+
content_part = Mail::Part.new(:content_type => 'multipart/alternative')
|
56
|
+
message.add_part(content_part)
|
57
|
+
end
|
58
|
+
|
59
|
+
if part_types.include? :html
|
60
|
+
html_part = Mail::Part.new do
|
61
|
+
body HTML_PART_WITH_CSS
|
62
|
+
content_type 'text/html; charset=UTF-8'
|
63
|
+
end
|
64
|
+
content_part.html_part = html_part
|
65
|
+
end
|
48
66
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
67
|
+
if part_types.include? :text
|
68
|
+
text_part = Mail::Part.new do
|
69
|
+
body TEXT_PART
|
70
|
+
content_type 'text/plain; charset=UTF-8'
|
71
|
+
end
|
72
|
+
content_part.text_part = text_part
|
73
|
+
end
|
53
74
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
75
|
+
if part_types.include? :attachment
|
76
|
+
message.add_file(:filename => 'foo.png', :content => 'foobar')
|
77
|
+
end
|
78
|
+
|
79
|
+
message.ready_to_send!
|
58
80
|
|
59
81
|
message
|
60
82
|
end
|
@@ -64,13 +86,15 @@ nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
64
86
|
|
65
87
|
case body_type
|
66
88
|
when :html
|
67
|
-
message.body =
|
89
|
+
message.body = HTML_PART_WITH_CSS
|
68
90
|
message.content_type 'text/html; charset=UTF-8'
|
69
91
|
when :text
|
70
92
|
message.body = TEXT_PART
|
71
93
|
message.content_type 'text/plain; charset=UTF-8'
|
72
94
|
end
|
73
95
|
|
96
|
+
message.ready_to_send!
|
97
|
+
|
74
98
|
message
|
75
99
|
end
|
76
100
|
|
@@ -79,7 +103,7 @@ nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
79
103
|
def base_message
|
80
104
|
Mail.new do
|
81
105
|
to 'some@email.com'
|
82
|
-
subject 'testing premailer-
|
106
|
+
subject 'testing premailer-rails'
|
83
107
|
end
|
84
108
|
end
|
85
109
|
end
|
data/spec/lib/hook_spec.rb
CHANGED
@@ -1,105 +1,77 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Premailer::Rails::Hook do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
Premailer::Rails::Hook.delivering_email(message)
|
8
|
-
end
|
4
|
+
def run_hook(message)
|
5
|
+
Premailer::Rails::Hook.delivering_email(message)
|
6
|
+
end
|
9
7
|
|
10
|
-
|
11
|
-
|
8
|
+
class Mail::Message
|
9
|
+
def html_string
|
10
|
+
(html_part || self).body.to_s
|
11
|
+
end
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
.any_instance.expects(:to_plain_text)
|
16
|
-
run_hook(message)
|
17
|
-
message.text_part.should be_a Mail::Part
|
18
|
-
end
|
14
|
+
let(:message) { Fixtures::Message.with_body(:html) }
|
15
|
+
let(:processed_message) { run_hook(message) }
|
19
16
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
17
|
+
it 'inlines the CSS' do
|
18
|
+
expect { run_hook(message) }.to \
|
19
|
+
change { message.html_string.include?("<p style=") }
|
20
|
+
end
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
run_hook(message)
|
31
|
-
Premailer::Rails.config[:generate_text_part] = true
|
32
|
-
message.text_part.should be_nil
|
33
|
-
message.html_part.should be_a Mail::Part
|
34
|
-
end
|
22
|
+
it 'replaces the html part with an alternative part containing text and html parts' do
|
23
|
+
processed_message.content_type.should include 'multipart/alternative'
|
24
|
+
processed_message.parts.should =~ [message.html_part, message.text_part]
|
25
|
+
end
|
35
26
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
27
|
+
it 'generates a text part from the html' do
|
28
|
+
expect { run_hook(message) }.to change(message, :text_part)
|
29
|
+
end
|
41
30
|
|
42
|
-
|
43
|
-
|
31
|
+
context 'when message contains no html' do
|
32
|
+
let(:message) { Fixtures::Message.with_body(:text) }
|
44
33
|
|
45
|
-
|
46
|
-
|
47
|
-
run_hook(message)
|
48
|
-
end
|
34
|
+
it 'does not modify the message' do
|
35
|
+
expect { run_hook(message) }.to_not change(message, :html_string)
|
49
36
|
end
|
37
|
+
end
|
50
38
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
it 'should not create a text part from the html part' do
|
55
|
-
Premailer::Rails::CustomizedPremailer \
|
56
|
-
.any_instance.expects(:to_plain_text).never
|
57
|
-
run_hook(message)
|
58
|
-
message.text_part.should be_a Mail::Part
|
59
|
-
end
|
39
|
+
context 'when message also contains a text part' do
|
40
|
+
let(:message) { Fixtures::Message.with_parts(:html, :text) }
|
60
41
|
|
61
|
-
|
62
|
-
|
63
|
-
.any_instance.expects(:to_inline_css)
|
64
|
-
run_hook(message)
|
65
|
-
end
|
42
|
+
it 'does not generate a text part' do
|
43
|
+
expect { run_hook(message) }.to_not change(message, :text_part)
|
66
44
|
end
|
67
45
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
.any_instance.expects(:to_plain_text)
|
74
|
-
run_hook(message)
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'should create a html part and inline the css' do
|
78
|
-
Premailer::Rails::CustomizedPremailer \
|
79
|
-
.any_instance.expects(:to_inline_css)
|
80
|
-
run_hook(message)
|
81
|
-
message.html_part.should be_a Mail::Part
|
82
|
-
end
|
46
|
+
it 'does not replace any message part' do
|
47
|
+
expect { run_hook(message) }.to_not \
|
48
|
+
change { message.all_parts.map(&:content_type) }
|
49
|
+
end
|
50
|
+
end
|
83
51
|
|
84
|
-
|
85
|
-
|
86
|
-
|
52
|
+
context 'when text generation is disabled' do
|
53
|
+
it 'does not generate a text part' do
|
54
|
+
begin
|
87
55
|
Premailer::Rails.config[:generate_text_part] = false
|
88
|
-
|
56
|
+
|
57
|
+
expect { run_hook(message) }.to_not change(message, :text_part)
|
58
|
+
ensure
|
89
59
|
Premailer::Rails.config[:generate_text_part] = true
|
90
|
-
message.text_part.should be_nil
|
91
|
-
message.html_part.should be_nil
|
92
|
-
message.body.should_not be_empty
|
93
60
|
end
|
94
61
|
end
|
62
|
+
end
|
95
63
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
64
|
+
context 'when message also contains an attachment' do
|
65
|
+
let(:message) { Fixtures::Message.with_parts(:html, :attachment) }
|
66
|
+
it 'does not mess with it' do
|
67
|
+
message.content_type.should include 'multipart/mixed'
|
68
|
+
message.parts.first.content_type.should include 'text/html'
|
69
|
+
message.parts.last.content_type.should include 'image/png'
|
70
|
+
|
71
|
+
processed_message.content_type.should include 'multipart/mixed'
|
72
|
+
processed_message.parts.first.content_type.should \
|
73
|
+
include 'multipart/alternative'
|
74
|
+
processed_message.parts.last.content_type.should include 'image/png'
|
103
75
|
end
|
104
76
|
end
|
105
77
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: premailer-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philipe Fatio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: premailer
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: coveralls
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
description: |-
|
126
140
|
This gem brings you the power of the premailer gem to Rails
|
127
141
|
without any configuration needs. Create HTML emails,
|
@@ -133,6 +147,7 @@ executables: []
|
|
133
147
|
extensions: []
|
134
148
|
extra_rdoc_files: []
|
135
149
|
files:
|
150
|
+
- .coveralls.yml
|
136
151
|
- .gitignore
|
137
152
|
- .rspec
|
138
153
|
- .travis.yml
|
@@ -148,9 +163,7 @@ files:
|
|
148
163
|
- lib/premailer/rails/customized_premailer.rb
|
149
164
|
- lib/premailer/rails/hook.rb
|
150
165
|
- lib/premailer/rails/nokogiri_fix.rb
|
151
|
-
- lib/premailer/rails/premailer.rb
|
152
166
|
- lib/premailer/rails/version.rb
|
153
|
-
- lib/premailer/rails3.rb
|
154
167
|
- premailer-rails.gemspec
|
155
168
|
- spec/fixtures/html.rb
|
156
169
|
- spec/fixtures/message.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
class Premailer
|
2
|
-
module Rails
|
3
|
-
class CustomizedPremailer < ::Premailer
|
4
|
-
def initialize(html)
|
5
|
-
# In order to pass the CSS as string to super it is necessary to access
|
6
|
-
# the parsed HTML beforehand. To do so, the adapter needs to be
|
7
|
-
# initialized. The ::Premailer::Adaptor handles the discovery of a
|
8
|
-
# suitable adaptor (Nokogiri or Hpricot). To make load_html work, an
|
9
|
-
# adaptor needs to be included and @options[:with_html_string] needs to
|
10
|
-
# be set. For further information, refer to ::Premailer#initialize.
|
11
|
-
@options = Rails.config.merge(:with_html_string => true)
|
12
|
-
Premailer.send(:include, Adapter.find(Adapter.use))
|
13
|
-
doc = load_html(html)
|
14
|
-
|
15
|
-
options = @options.merge(:css_string => CSSHelper.css_for_doc(doc))
|
16
|
-
super(html, options)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/lib/premailer/rails3.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'premailer'
|
2
|
-
require 'action_mailer'
|
3
|
-
|
4
|
-
require 'premailer/rails/css_loaders'
|
5
|
-
require 'premailer/rails/css_helper'
|
6
|
-
require 'premailer/rails/customized_premailer'
|
7
|
-
require 'premailer/rails/hook'
|
8
|
-
require 'premailer/rails/nokogiri_fix'
|
9
|
-
|
10
|
-
class Premailer
|
11
|
-
module Rails
|
12
|
-
@config = {
|
13
|
-
:input_encoding => 'UTF-8',
|
14
|
-
:inputencoding => 'UTF-8',
|
15
|
-
:generate_text_part => true
|
16
|
-
}
|
17
|
-
class << self
|
18
|
-
attr_accessor :config
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
ActionMailer::Base.register_interceptor(Premailer::Rails::Hook)
|