Skip to content

Commit 122f450

Browse files
committed
0.3.0 release
1 parent c806709 commit 122f450

File tree

4 files changed

+53
-10
lines changed

4 files changed

+53
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
## [0.3.0] - 2021-04-18
10+
## [0.3.0] - 2021-04-17
1111

1212
### Added
1313

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ dependencies in `mix.exs`:
4242
```elixir
4343
def deps do
4444
[
45-
{:mjml_eex, "~> 0.2.0"}
45+
{:mjml_eex, "~> 0.3.0"}
4646
]
4747
end
4848
```
@@ -78,7 +78,7 @@ Checkout my [GitHub Sponsorship page](https://github.com/sponsors/akoutmos) if y
7878

7979
### Basic Usage
8080

81-
Add `{:mjml_eex, "~> 0.2.0"}` to your `mix.exs` file and run `mix deps.get`. After you have that in place, you
81+
Add `{:mjml_eex, "~> 0.3.0"}` to your `mix.exs` file and run `mix deps.get`. After you have that in place, you
8282
can go ahead and create a template module like so:
8383

8484
```elixir

lib/mjml_eex/layout.ex

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,56 @@
11
defmodule MjmlEEx.Layout do
22
@moduledoc """
3-
This module allows you to define a MJML layouts so that you
4-
can create reusable email skeletons.
5-
"""
3+
This module allows you to define an MJML layout so that you
4+
can create reusable email skeletons. To use layouts with your
5+
MJML emails, create a layout template that contains an
6+
`<%= @inner_content %>` expression in it like so:
7+
8+
```html
9+
<mjml>
10+
<mj-head>
11+
<mj-title>Say hello to card</mj-title>
12+
<mj-font name="Roboto" href="https://fonts.googleapis.com/css?family=Montserrat:300,400,500"></mj-font>
13+
<mj-attributes>
14+
<mj-all font-family="Montserrat, Helvetica, Arial, sans-serif"></mj-all>
15+
<mj-text font-weight="400" font-size="16px" color="#000000" line-height="24px"></mj-text>
16+
<mj-section padding="<%= @padding %>"></mj-section>
17+
</mj-attributes>
18+
</mj-head>
19+
20+
<%= @inner_content %>
21+
</mjml>
22+
```
23+
24+
You can also include additional assigns like `@padding` in this
25+
example. Just make sure that you provide that assign when you
26+
are rendering the final template. With that in place, you can
27+
define a layout module like so
28+
29+
```elixir
30+
defmodule BaseLayout do
31+
use MjmlEEx.Layout, mjml_layout: "base_layout.mjml.eex"
32+
end
33+
```
34+
35+
And then use it in conjunction with your templates like so:
36+
37+
```elixir
38+
defmodule MyTemplate do
39+
use MjmlEEx,
40+
mjml_template: "my_template.mjml.eex",
41+
layout: BaseLayout
42+
end
43+
```
44+
45+
Then in your template, all you need to provide are the portions that
46+
you need to complete the layout:
647
7-
@doc """
8-
Returns the MJML markup for the layout as a string.
48+
```html
49+
<mj-body>
50+
...
51+
</mj-body>
52+
```
953
"""
10-
@callback render(opts :: keyword()) :: String.t()
1154

1255
defmacro __using__(opts) do
1356
mjml_layout =

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defmodule MjmlEEx.MixProject do
44
def project do
55
[
66
app: :mjml_eex,
7-
version: "0.2.0",
7+
version: "0.3.0",
88
elixir: ">= 1.11.0",
99
elixirc_paths: elixirc_paths(Mix.env()),
1010
name: "MJML EEx",

0 commit comments

Comments
 (0)