mjml 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -1
  3. data/lib/mjml.rb +1 -1
  4. data/lib/mjml/version.rb +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f57a6a317180b7aa3e60a648f98935a7ba835196
4
- data.tar.gz: 277cce08fd8ef9c48865dc3818f154e220d60751
3
+ metadata.gz: 8cec8c1d702583ace1b455a66ba18e37b1b2cee8
4
+ data.tar.gz: c7af250352177702622ed25cc9647c3fd4db1f14
5
5
  SHA512:
6
- metadata.gz: 509e3f3f7850261c0ac30833324c9e0ffd8f670246277632d02f26c5817e38949757adcf8768b43840982df807f9eea84e3de1431a2d369149243133fb763d11
7
- data.tar.gz: e02b504e6bec98782f292db5588e8d474685dbeaf4c9f1a916b1a99608780c4e6241aa3c403740a5d9a479b3f36809ca3060502157e3aba01bb2b2bd96b3508a
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
@@ -10,7 +10,7 @@ module Mjml
10
10
  Render.new(path, args, instance).execute
11
11
  end
12
12
 
13
- def configure
13
+ def self.configure
14
14
  yield Config
15
15
  end
16
16
  end
data/lib/mjml/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mjml
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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-05-19 00:00:00.000000000 Z
11
+ date: 2016-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler