premailer-rails 1.8.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +6 -1
- data/VERSION +1 -1
- data/lib/premailer/rails.rb +2 -1
- data/lib/premailer/rails/css_loaders/asset_pipeline_loader.rb +1 -1
- data/lib/premailer/rails/css_loaders/network_loader.rb +11 -1
- data/lib/premailer/rails/hook.rb +1 -1
- data/spec/unit/css_loaders/asset_pipeline_loader_spec.rb +6 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d3ecd8b9d9f55c3039cad6467d7de1fc2676565
|
4
|
+
data.tar.gz: 985538b2930d3bae69fe75b9415af3f4d4f411eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e13cd460126fb67c58f89d186157463ca47162a228cc12e46dfc373bd9773d30a11ba318c9ea36d1892474b94bf3a2008c49e847ed35b049acf095f6da517d0
|
7
|
+
data.tar.gz: c0cdc0051dd65ef19bffb36378943733c4f66f68c3ef8662f77a66763a4439f8024daf20b1a35f5d11285bb730bc8ef256eed8ea8460fee387fa2fdda8f9a39b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
ki premailer-rails
|
2
2
|
|
3
3
|
CSS styled emails without the hassle.
|
4
4
|
|
@@ -137,6 +137,11 @@ class UserMailer < ActionMailer::Base
|
|
137
137
|
end
|
138
138
|
```
|
139
139
|
|
140
|
+
Note that the mere presence of this header causes premailer to be skipped, i.e.,
|
141
|
+
even setting `skip_premailer: false` will cause premailer to be skipped. The
|
142
|
+
reason for that is that the `skip_premailer` is a simple header and the value is
|
143
|
+
transformed into a string, causing `'false'` to become truethy.
|
144
|
+
|
140
145
|
## Small Print
|
141
146
|
|
142
147
|
### Author
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.8.
|
1
|
+
1.8.1
|
data/lib/premailer/rails.rb
CHANGED
@@ -6,7 +6,6 @@ require 'premailer/rails/css_loaders'
|
|
6
6
|
require 'premailer/rails/css_helper'
|
7
7
|
require 'premailer/rails/customized_premailer'
|
8
8
|
require 'premailer/rails/hook'
|
9
|
-
require 'premailer/rails/railtie' if defined?(Rails)
|
10
9
|
|
11
10
|
class Premailer
|
12
11
|
module Rails
|
@@ -27,3 +26,5 @@ class Premailer
|
|
27
26
|
end
|
28
27
|
end
|
29
28
|
end
|
29
|
+
|
30
|
+
require 'premailer/rails/railtie' if defined?(Rails)
|
@@ -14,7 +14,7 @@ class Premailer
|
|
14
14
|
|
15
15
|
if not valid_uri?(uri) and defined?(::Rails)
|
16
16
|
scheme, host =
|
17
|
-
|
17
|
+
asset_host.split(%r{:?//})
|
18
18
|
scheme = 'http' if scheme.blank?
|
19
19
|
uri.scheme ||= scheme
|
20
20
|
uri.host ||= host
|
@@ -26,6 +26,16 @@ class Premailer
|
|
26
26
|
def valid_uri?(uri)
|
27
27
|
uri.host.present? && uri.scheme.present?
|
28
28
|
end
|
29
|
+
|
30
|
+
def asset_host
|
31
|
+
host = ::Rails.configuration.action_controller.asset_host
|
32
|
+
|
33
|
+
if host.respond_to?(:call)
|
34
|
+
host.call
|
35
|
+
else
|
36
|
+
host
|
37
|
+
end
|
38
|
+
end
|
29
39
|
end
|
30
40
|
end
|
31
41
|
end
|
data/lib/premailer/rails/hook.rb
CHANGED
@@ -42,7 +42,7 @@ class Premailer
|
|
42
42
|
# Returns true if the message itself has a content type of text/html, thus
|
43
43
|
# it does not contain other parts such as alternatives and attachments.
|
44
44
|
def pure_html_message?
|
45
|
-
message.content_type.include?('text/html')
|
45
|
+
message.content_type && message.content_type.include?('text/html')
|
46
46
|
end
|
47
47
|
|
48
48
|
def generate_html_part_replacement
|
@@ -17,11 +17,16 @@ describe Premailer::Rails::CSSLoaders::AssetPipelineLoader do
|
|
17
17
|
it { is_expected.to eq('application.css') }
|
18
18
|
end
|
19
19
|
|
20
|
-
context "when asset file path contains fingerprint" do
|
20
|
+
context "when asset file path contains 32 chars fingerprint" do
|
21
21
|
let(:asset) { 'application-6776f581a4329e299531e1d52aa59832.css' }
|
22
22
|
it { is_expected.to eq('application.css') }
|
23
23
|
end
|
24
24
|
|
25
|
+
context "when asset file path contains 64 chars fingerprint" do
|
26
|
+
let(:asset) { 'application-02275ccb3fd0c11615bbfb11c99ea123ca2287e75045fe7b72cefafb880dad2b.css' }
|
27
|
+
it { is_expected.to eq('application.css') }
|
28
|
+
end
|
29
|
+
|
25
30
|
context "when asset file page contains numbers, but not a fingerprint" do
|
26
31
|
let(:asset) { 'test/20130708152545-foo-bar.css' }
|
27
32
|
it { is_expected.to eq("test/20130708152545-foo-bar.css") }
|
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.8.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philipe Fatio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: premailer
|
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
184
|
version: '0'
|
185
185
|
requirements: []
|
186
186
|
rubyforge_project:
|
187
|
-
rubygems_version: 2.
|
187
|
+
rubygems_version: 2.4.5
|
188
188
|
signing_key:
|
189
189
|
specification_version: 4
|
190
190
|
summary: Easily create styled HTML emails in Rails.
|