mjml 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -1
- data/lib/mjml.rb +1 -1
- data/lib/mjml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cec8c1d702583ace1b455a66ba18e37b1b2cee8
|
4
|
+
data.tar.gz: c7af250352177702622ed25cc9647c3fd4db1f14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c7cc195ecddb7d4be02ece19e038f66d7053648571ef3ebfc95cf0548350ecfd3ba552cf9d96efd90e918d2b3efe67d533e61ab6f6f638a8a2eead051554f54
|
7
|
+
data.tar.gz: 93a99c4705edfe03e7fc21677f080e9ba2144888d98498100b4ed9d0b853e5495f59d29219f556e3bbec7ecb86c002ae7626e5710e5fe29a8640265bf2f40aba
|
data/README.md
CHANGED
@@ -28,13 +28,43 @@ Mjml.configure do |config|
|
|
28
28
|
end
|
29
29
|
```
|
30
30
|
|
31
|
+
You have to install mjml compiler via `npm install mjml` to use this gem
|
32
|
+
|
33
|
+
The `exec_path` will be set default as `node_modules/mjml/bin/mjml`. If you use heroku you can config [multiple buildpacks](https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app) to make it support nodejs
|
34
|
+
|
35
|
+
#### Mjmj#render
|
36
|
+
|
37
|
+
`Mjml.render(template_path, template_variable, binding)`: this render method accept three parameters
|
38
|
+
+ template_path: the location of your template
|
39
|
+
+ template_variable: these variables which be passed to template so that you can use something like this `<div><%= name %></div>`
|
40
|
+
+ binding: you can get something like mailer binding to support rails path helper
|
41
|
+
|
31
42
|
#### Mailer
|
32
43
|
|
44
|
+
You can use in mailer
|
45
|
+
|
33
46
|
```ruby
|
34
|
-
body = Mjml.render("#{Dir.pwd}/app/views/template") # => template.mjml
|
47
|
+
body = Mjml.render("#{Dir.pwd}/app/views/template", { name: 'Mjml parser' }) # => template.mjml
|
35
48
|
mail(to: xxx, subject: xxx, body: body, content_type: 'text/html')
|
36
49
|
```
|
37
50
|
|
51
|
+
and `template.mjml`
|
52
|
+
```html
|
53
|
+
<mjml>
|
54
|
+
<mj-body>
|
55
|
+
<mj-container>
|
56
|
+
<mj-section>
|
57
|
+
<mj-column>
|
58
|
+
<mj-image width="100" src="https://mjml.io/assets/img/logo-small.png"></mj-image>
|
59
|
+
<mj-divider border-color="#F45E43"></mj-divider>
|
60
|
+
<mj-text font-size="20px" color="#F45E43" font-family="helvetica">Hello <%= name %></mj-text>
|
61
|
+
</mj-column>
|
62
|
+
</mj-section>
|
63
|
+
</mj-container>
|
64
|
+
</mj-body>
|
65
|
+
</mjml>
|
66
|
+
```
|
67
|
+
|
38
68
|
## Development
|
39
69
|
|
40
70
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/mjml.rb
CHANGED
data/lib/mjml/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mjml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MQuy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|