Skip to content

Commit

Permalink
0.3.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
akoutmos committed Apr 17, 2022
1 parent c806709 commit 122f450
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.3.0] - 2021-04-18
## [0.3.0] - 2021-04-17

### Added

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies in `mix.exs`:
```elixir
def deps do
[
{:mjml_eex, "~> 0.2.0"}
{:mjml_eex, "~> 0.3.0"}
]
end
```
Expand Down Expand Up @@ -78,7 +78,7 @@ Checkout my [GitHub Sponsorship page](https://github.com/sponsors/akoutmos) if y

### Basic Usage

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

```elixir
Expand Down
55 changes: 49 additions & 6 deletions lib/mjml_eex/layout.ex
Original file line number Diff line number Diff line change
@@ -1,13 +1,56 @@
defmodule MjmlEEx.Layout do
@moduledoc """
This module allows you to define a MJML layouts so that you
can create reusable email skeletons.
"""
This module allows you to define an MJML layout so that you
can create reusable email skeletons. To use layouts with your
MJML emails, create a layout template that contains an
`<%= @inner_content %>` expression in it like so:
```html
<mjml>
<mj-head>
<mj-title>Say hello to card</mj-title>
<mj-font name="Roboto" href="https://fonts.googleapis.com/css?family=Montserrat:300,400,500"></mj-font>
<mj-attributes>
<mj-all font-family="Montserrat, Helvetica, Arial, sans-serif"></mj-all>
<mj-text font-weight="400" font-size="16px" color="#000000" line-height="24px"></mj-text>
<mj-section padding="<%= @padding %>"></mj-section>
</mj-attributes>
</mj-head>
<%= @inner_content %>
</mjml>
```
You can also include additional assigns like `@padding` in this
example. Just make sure that you provide that assign when you
are rendering the final template. With that in place, you can
define a layout module like so
```elixir
defmodule BaseLayout do
use MjmlEEx.Layout, mjml_layout: "base_layout.mjml.eex"
end
```
And then use it in conjunction with your templates like so:
```elixir
defmodule MyTemplate do
use MjmlEEx,
mjml_template: "my_template.mjml.eex",
layout: BaseLayout
end
```
Then in your template, all you need to provide are the portions that
you need to complete the layout:
@doc """
Returns the MJML markup for the layout as a string.
```html
<mj-body>
...
</mj-body>
```
"""
@callback render(opts :: keyword()) :: String.t()

defmacro __using__(opts) do
mjml_layout =
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule MjmlEEx.MixProject do
def project do
[
app: :mjml_eex,
version: "0.2.0",
version: "0.3.0",
elixir: ">= 1.11.0",
elixirc_paths: elixirc_paths(Mix.env()),
name: "MJML EEx",
Expand Down

0 comments on commit 122f450

Please sign in to comment.