herbes 0.0.7 → 0.0.8
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/Gemfile.lock +1 -1
- data/README.md +9 -0
- data/lib/herbes/email.rb +6 -6
- data/lib/herbes/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2bf4544710790140678482a730056a7c022339651069dc5ee99c688789fb6b56
|
|
4
|
+
data.tar.gz: a7fd826fd9e4916c7868a32db3a09ab4d83224cf08073a0355c800de4de43e45
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88b3e75ee4e9646d12cf1927949d45a821cc110c7787cb866a496c069d345af38b10ecaeb9e74a6c5096880cdb3cd86bb0c0bd2d8b78c784af7b55daa4060afe
|
|
7
|
+
data.tar.gz: 4cab455ec4992bb19dd43d9791a0b63fddba33a799cd120b219dec148eb38b4787b0f653dc744be77189a0377c4c3f5940cbd3da64cc0d34da0b4490b1737e90
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -63,3 +63,12 @@ Herbes::Email.render(params, template_path: 'template.html.erb', style_path: 'st
|
|
|
63
63
|
Herbes::Email.render(params, style_string: custom_css)
|
|
64
64
|
|
|
65
65
|
```
|
|
66
|
+
|
|
67
|
+
#### extending default style
|
|
68
|
+
|
|
69
|
+
```ruby
|
|
70
|
+
|
|
71
|
+
Herbes::Email.render(params, extend_default_style: true, style_string: custom_css)
|
|
72
|
+
Herbes::Email.render(params, extend_default_style: true, style_path: 'style.css')
|
|
73
|
+
|
|
74
|
+
```
|
data/lib/herbes/email.rb
CHANGED
|
@@ -6,7 +6,7 @@ require 'premailer'
|
|
|
6
6
|
|
|
7
7
|
module Herbes
|
|
8
8
|
class Email < OpenStruct
|
|
9
|
-
def render_style(path =
|
|
9
|
+
def render_style(path = Constants::DEFAULT_EMAIL_STYLE_PATH)
|
|
10
10
|
File.read(path)
|
|
11
11
|
end
|
|
12
12
|
|
|
@@ -29,12 +29,12 @@ module Herbes
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def render_template(path = nil)
|
|
32
|
-
path ||=
|
|
32
|
+
path ||= Constants::DEFAULT_EMAIL_TEMPLATE_PATH
|
|
33
33
|
render_html(File.read(path))
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def render_inline_template(path = nil, premailer_options = {})
|
|
37
|
-
path ||=
|
|
37
|
+
path ||= Constants::DEFAULT_EMAIL_TEMPLATE_PATH
|
|
38
38
|
Premailer.new(
|
|
39
39
|
render_template(path),
|
|
40
40
|
[
|
|
@@ -51,9 +51,9 @@ module Herbes
|
|
|
51
51
|
premailer = options[:premailer] || {}
|
|
52
52
|
|
|
53
53
|
# remove unicode space as it fails aws cognito regex
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
new(params, options)
|
|
55
|
+
.render_inline_template(path, premailer)
|
|
56
|
+
.gsub("\u00A0", '')
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
end
|
data/lib/herbes/version.rb
CHANGED